You are here

function block_attributes_form_block_form_submit in Block Attributes 8

Submit callback which adds the attributes to the block configuration.

1 string reference to 'block_attributes_form_block_form_submit'
block_attributes_form_block_form_alter in ./block_attributes.module
Implements hook_form_FORM_ID_alter().

File

./block_attributes.module, line 84

Code

function block_attributes_form_block_form_submit($form, FormStateInterface $form_state) {
  $block = $form_state
    ->getFormObject()
    ->getEntity();
  $plugin = $block
    ->getPlugin();
  $attributes = $form_state
    ->getValue('settings')['attributes'];
  $plugin
    ->setConfigurationValue('attributes', $attributes);
  $block
    ->save();
}