You are here

public function MenuBlock::blockSubmit in Menu Block 8

Overrides SystemMenuBlock::blockSubmit

File

src/Plugin/Block/MenuBlock.php, line 202

Class

MenuBlock
Provides an extended Menu block.

Namespace

Drupal\menu_block\Plugin\Block

Code

public function blockSubmit($form, FormStateInterface $form_state) {
  $this->configuration['follow'] = $form_state
    ->getValue('follow');
  $this->configuration['follow_parent'] = $form_state
    ->getValue('follow_parent');
  $this->configuration['level'] = $form_state
    ->getValue('level');
  $this->configuration['depth'] = $form_state
    ->getValue('depth');
  $this->configuration['expand_all_items'] = (bool) $form_state
    ->getValue('expand_all_items');

  // On save, the core config property (expand_all_items) gets updated, and
  // the contrib config property value (expand) is deleted/removed altogether.
  if (isset($this->configuration['expand'])) {
    unset($this->configuration['expand']);
  }
  $this->configuration['parent'] = $form_state
    ->getValue('parent');
  $this->configuration['suggestion'] = $form_state
    ->getValue('suggestion');
  $this->configuration['label_type'] = $form_state
    ->getValue('label_type');
  $this->configuration['label_link'] = $form_state
    ->getValue('label_link');
}