You are here

public function ParagraphBlocksLabeller::hookFormPanelsIpeBlockPluginFormAlter in Paragraph blocks 3.x

Same name and namespace in other branches
  1. 8.2 src/ParagraphBlocksLabeller.php \Drupal\paragraph_blocks\ParagraphBlocksLabeller::hookFormPanelsIpeBlockPluginFormAlter()

Change the title on the add/edit form.

Parameters

array &$form: The form.

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

See also

hook_form_FORM_ID_alter()

File

src/ParagraphBlocksLabeller.php, line 67

Class

ParagraphBlocksLabeller
Labels the paragraph blocks once the entity context is known.

Namespace

Drupal\paragraph_blocks

Code

public function hookFormPanelsIpeBlockPluginFormAlter(array &$form, FormStateInterface $form_state) {
  $title = $this
    ->getTitle($form['plugin_id']['#value'], $enabled);
  if (!empty($title) && $enabled) {
    $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;
  }
}