You are here

public function PanelizerEntityConfigPages::hook_form_alter in Config Pages 7

Implements hook_form_alter().

File

plugins/panelizer/entity/PanelizerEntityConfigPages.class.php, line 91
Class definition.

Class

PanelizerEntityConfigPages
Panelizer class for config pages.

Code

public function hook_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'config_pages_type_form' && module_exists('panels_ipe')) {
    $config_pages_type = $form['#config_pages_type'];
    if (isset($form['#config_pages_type']) && !empty($form['#config_pages_type']->type)) {
      $bundle = $form['#config_pages_type']->type;

      // 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',
      ));
      if (!empty($form['panelizer'])) {
        $form['panelizer']['#description'] = t('EXPERIMENTAL! Allows to panelize Default view mode with IPE.');
      }
    }
  }
}