You are here

function paragraph_blocks_form_panels_ipe_block_plugin_form_alter in Paragraph blocks 8.2

Same name and namespace in other branches
  1. 8 paragraph_blocks.module \paragraph_blocks_form_panels_ipe_block_plugin_form_alter()
  2. 3.x paragraph_blocks.module \paragraph_blocks_form_panels_ipe_block_plugin_form_alter()

Implements hook_form_FORM_ID_alter().

File

./paragraph_blocks.module, line 74
Contains paragraph_blocks.module.

Code

function paragraph_blocks_form_panels_ipe_block_plugin_form_alter(&$form, FormStateInterface $form_state) {

  // Get the paragraph blocks entity manager.

  /** @var \Drupal\paragraph_blocks\ParagraphBlocksLabeller $labeller */
  $labeller = \Drupal::service('paragraph_blocks.labeller');

  // Get the title of the plugin.
  $title = $labeller
    ->getTitle($form['plugin_id']['#value']);
  if (!empty($title)) {
    $section =& $form['flipper']['front']['settings'];
    $section['admin_label']['#type'] = 'hidden';
    $section['label']['#type'] = 'hidden';
    $section['label']['#required'] = FALSE;
    $section['label_display']['#type'] = 'hidden';
    $section['label_display']['#value'] = 0;
    $section['label']['#value'] = $title;
  }
}