You are here

function block_style_plugins_form_block_form_alter in Block Style Plugins 8

Same name and namespace in other branches
  1. 8.2 block_style_plugins.module \block_style_plugins_form_block_form_alter()

Implements hook_form_FORM_ID_alter().

For the ID form_block.

File

./block_style_plugins.module, line 32
Contains block_style_plugins.module.

Code

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

  // Retrieve a list of style plugin definitions.

  /** @var Drupal\block_style_plugins\Plugin\BlockStyleManager $plugin_manager */
  $plugin_manager = \Drupal::service('plugin.manager.block_style.processor');
  $style_plugins = $plugin_manager
    ->getDefinitions();
  foreach ($style_plugins as $name => $plugin) {

    /** @var \Drupal\block_style_plugins\Plugin\BlockStyleInterface $style_plugin */
    $style_plugin = $plugin_manager
      ->createInstance($name);
    $form = $style_plugin
      ->prepareForm($form, $form_state);
  }
}