You are here

public function PanelizerEntityParagraphsItem::hook_form_alter in Paragraphs 7

Implements hook_form_alter().

File

plugins/panelizer/entity/PanelizerEntityParagraphsItem.class.php, line 105

Class

PanelizerEntityParagraphsItem
Panelizer Entity paragraphs item plugin class.

Code

public function hook_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'paragraphs_admin_bundle_form') {
    if (isset($form['#paragraphs_bundle'])) {
      $bundle = $form['#paragraphs_bundle']->bundle;

      // Workaround for non-existant bundle value on updates.
      $form['panelizer_bundle'] = array(
        '#type' => 'value',
        '#value' => $bundle,
      );
      $this
        ->add_bundle_setting_form($form, $form_state, $bundle, array(
        empty($form_state['values']['locked']) && empty($bundle) ? 'bundle' : 'panelizer_bundle',
      ));
    }
  }
}