You are here

function simplify_form_block_content_form_alter in Simplify 8

Implements hook_form_FORM_ID_alter() for block_add_block_form().

Overrides the "create new block" form ti be simplified.

File

./simplify.module, line 285
Hooks implemented by the simplify module.

Code

function simplify_form_block_content_form_alter(&$form, FormStateInterface $form_state, $form_id) {

  // @todo This must be handled in a #process handler.
  $block = $form_state
    ->getFormObject()
    ->getEntity();
  $block_type = $block->type->entity;

  // Get array of fields to hide.
  $global_fields = _simplify_get_config_value('simplify_blocks_global');
  $type_fields = _simplify_get_config_value('simplify_blocks', [], 'simplify.block_type.' . $block_type
    ->id());
  $fields = array_merge($global_fields, $type_fields);

  // Hide fields.
  simplify_hide_fields($fields, $form);
}