You are here

function collapsiblock_submit in Collapsiblock 8

Same name and namespace in other branches
  1. 6 collapsiblock.module \collapsiblock_submit()
  2. 7.2 collapsiblock.module \collapsiblock_submit()
  3. 7 collapsiblock.module \collapsiblock_submit()

Block form submit callback.

1 string reference to 'collapsiblock_submit'
collapsiblock_form_block_form_alter in ./collapsiblock.module
Implements hook_form_FORM_ID_alter().

File

./collapsiblock.module, line 46
Make blocks collapsible.

Code

function collapsiblock_submit(array &$form, FormStateInterface $form_state) {
  $settings = $form_state
    ->getValues();
  if (!empty($form['id']['#default_value'])) {

    // Set default values for config which require dynamic values.
    \Drupal::configFactory()
      ->getEditable('block.block.' . $form['id']['#default_value'])
      ->set('collapsiblock.block-' . str_replace('_', '-', $settings['id']), $settings['collapsiblock_settings']['collapse_type'])
      ->save();
  }
}