You are here

function hook_block_plugin_form_alter in Block Form Alter 8

Alter block forms per block plugin.

Block forms for the 'block_content' and 'inline_content' plugins must use hook_block_type_form_alter().

Parameters

array $form: Nested array of form elements that comprise the form.

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

string $plugin: The machine name of the plugin implementing the block.

1 function implements hook_block_plugin_form_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

block_form_alter_test_block_plugin_form_alter in tests/modules/block_form_alter_test/block_form_alter_test.module
Implements hook_block_plugin_form_alter().
1 invocation of hook_block_plugin_form_alter()
_block_form_alter_block_plugin_form_alter_invoke in ./block_form_alter.module
Helper function to alter forms for block plugins.

File

./block_form_alter.api.php, line 26
Hooks provided by the block_form_alter module.

Code

function hook_block_plugin_form_alter(array &$form, FormStateInterface &$form_state, string $plugin) {
  if ($plugin == 'webform_block') {
    $form['settings']['redirect']['#default_value'] = TRUE;
    $form['settings']['redirect']['#disabled'] = TRUE;
  }
}