function SystemMenuBlock::blockSubmit

Same name and namespace in other branches
  1. 11.x core/modules/system/src/Plugin/Block/SystemMenuBlock.php \Drupal\system\Plugin\Block\SystemMenuBlock::blockSubmit()
  2. 10 core/modules/system/src/Plugin/Block/SystemMenuBlock.php \Drupal\system\Plugin\Block\SystemMenuBlock::blockSubmit()
  3. 9 core/modules/system/src/Plugin/Block/SystemMenuBlock.php \Drupal\system\Plugin\Block\SystemMenuBlock::blockSubmit()
  4. 8.9.x core/modules/system/src/Plugin/Block/SystemMenuBlock.php \Drupal\system\Plugin\Block\SystemMenuBlock::blockSubmit()

Overrides BlockPluginTrait::blockSubmit

1 method overrides SystemMenuBlock::blockSubmit()
NavigationMenuBlock::blockSubmit in core/modules/navigation/src/Plugin/Block/NavigationMenuBlock.php

File

core/modules/system/src/Plugin/Block/SystemMenuBlock.php, line 170

Class

SystemMenuBlock
Provides a generic Menu block.

Namespace

Drupal\system\Plugin\Block

Code

public function blockSubmit($form, FormStateInterface $form_state) {
  $this->configuration['level'] = $form_state->getValue('level');
  $this->configuration['depth'] = $form_state->getValue('depth') ?: NULL;
  $this->configuration['expand_all_items'] = $form_state->getValue('expand_all_items');
  // Reverse the form checkbox value to match the configuration name. While
  // this is counter-intuitive, it simplifies both the UI and the API logic
  // outside of this method.
  if ($form_state->getValue('add_active_trail_class')) {
    unset($this->configuration['ignore_active_trail']);
  }
  else {
    $this->configuration['ignore_active_trail'] = TRUE;
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.