You are here

function icon_block_form_submit in Icon API 8

Same name and namespace in other branches
  1. 7 modules/icon_block/icon_block.module \icon_block_form_submit()

Save supplied class.

1 string reference to 'icon_block_form_submit'
icon_block_form_alter in modules/icon_block/icon_block.module
Implements hook_form_alter().

File

modules/icon_block/icon_block.module, line 165
icon_block.module Provides icon integration with blocks.

Code

function icon_block_form_submit($form, &$form_state) {
  if ($form_state['values']['form_id'] == 'block_admin_configure' || $form_state['values']['form_id'] == 'block_add_block_form') {
    $module = $form_state['values']['module'];
    $delta = $form_state['values']['delta'];

    // Update block icon settings.
    if (isset($form_state['values']['icon_selector'])) {
      \Drupal::database()
        ->merge('block')
        ->key(array(
        'module' => $module,
        'delta' => $delta,
      ))
        ->fields(array(
        'icon' => serialize($form_state['values']['icon_selector']),
      ))
        ->execute();
    }
  }
}