You are here

function _fixed_block_content_update_on_save in Fixed Block Content 8

Block content form submit handler. Updates default content in fixed block.

Parameters

$form: The submitted form.

\Drupal\Core\Form\FormStateInterface $form_state: The form state.

1 string reference to '_fixed_block_content_update_on_save'
fixed_block_content_form_alter in ./fixed_block_content.module
Implements hook_form_alter().

File

./fixed_block_content.module, line 73
Provides permanent custom content blocks.

Code

function _fixed_block_content_update_on_save(&$form, FormStateInterface $form_state) {
  if ($form_state
    ->getValue('fixed_block_content_update') && ($fbid = $form_state
    ->getTemporaryValue('fixed_block_content_fbid')) && ($fixed_block = FixedBlockContent::load($fbid))) {

    // The operation itself is done on the custom block update hook.
    // @see fixed_block_content_block_content_update().
    $fbc_to_update =& drupal_static('fixed_block_content_update', []);
    $fbc_to_update[$form_state
      ->getFormObject()
      ->getEntity()
      ->id()] = $fixed_block;
  }
}