You are here

public function CheeseburgerMenu::blockSubmit in Cheeseburger Menu 8.4

Same name and namespace in other branches
  1. 8 src/Plugin/Block/CheeseburgerMenu.php \Drupal\cheeseburger_menu\Plugin\Block\CheeseburgerMenu::blockSubmit()
  2. 8.2 src/Plugin/Block/CheeseburgerMenu.php \Drupal\cheeseburger_menu\Plugin\Block\CheeseburgerMenu::blockSubmit()
  3. 8.3 src/Plugin/Block/CheeseburgerMenu.php \Drupal\cheeseburger_menu\Plugin\Block\CheeseburgerMenu::blockSubmit()

Sends and store the block by collected data.

Overrides BlockPluginTrait::blockSubmit

File

src/Plugin/Block/CheeseburgerMenu.php, line 468
Cheeseburger class extends BlockBase.

Class

CheeseburgerMenu
Block info.

Namespace

Drupal\cheeseburger_menu\Plugin\Block

Code

public function blockSubmit($form, FormStateInterface $form_state) {
  foreach ($form_state
    ->getValues() as $key => $value) {
    $this->configuration[$key] = $value;
  }
  $this
    ->unsetNotSelected($this->configuration['menu']);
  $this
    ->unsetNotSelected($this->configuration['taxonomy_vocabulary']);
  $form_object = $form_state
    ->getFormObject();
  if (method_exists($form_object, 'getEntity')) {
    $entity = $form_object
      ->getEntity();
    $this->configuration['block_machine_name'] = $entity
      ->id();
  }
  parent::blockSubmit($form, $form_state);
}