public function PanelizerEntityDefault::add_bundle_setting_form in Panelizer 7.2
Same name and namespace in other branches
- 7.3 plugins/entity/PanelizerEntityDefault.class.php \PanelizerEntityDefault::add_bundle_setting_form()
Add the panelizer settings form to a single entity bundle config form.
Parameters
&$form: The form array.
&$form_state: The form state array.
$bundle: The machine name of the bundle this form is for.
$type_location: The location in the form state values that the bundle name will be; this is used so that if a machine name of a bundle is changed, Panelizer can update as much as possible.
3 calls to PanelizerEntityDefault::add_bundle_setting_form()
- PanelizerEntityNode::hook_form_alter in plugins/
entity/ PanelizerEntityNode.class.php - Implements a delegated hook_form_alter.
- PanelizerEntityTaxonomyTerm::hook_form_alter in plugins/
entity/ PanelizerEntityTaxonomyTerm.class.php - Implements a delegated hook_form_alter.
- PanelizerEntityUser::hook_form_alter in plugins/
entity/ PanelizerEntityUser.class.php - Implements a delegated hook_form_alter.
File
- plugins/
entity/ PanelizerEntityDefault.class.php, line 509 - Base class for the Panelizer Entity plugin.
Class
- PanelizerEntityDefault
- Base class for the Panelizer Entity plugin.
Code
public function add_bundle_setting_form(&$form, &$form_state, $bundle, $type_location) {
$settings = !empty($this->plugin['bundles'][$bundle]) ? $this->plugin['bundles'][$bundle] : array(
'status' => FALSE,
'default' => FALSE,
'choice' => FALSE,
);
$form['panelizer'] = array(
'#type' => 'fieldset',
'#title' => t('Panelizer'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#group' => 'additional_settings',
'#attributes' => array(
'class' => array(
'panelizer-node-type-settings-form',
),
),
'#bundle' => $bundle,
'#location' => $type_location,
'#tree' => TRUE,
'#access' => panelizer_administer_entity_bundle($this, $bundle),
);
$form['panelizer']['status'] = array(
'#title' => t('Panelize'),
'#type' => 'checkbox',
'#default_value' => !empty($settings['status']),
'#id' => 'panelizer-status',
);
$form['panelizer']['default'] = array(
'#title' => t('Provide default panel'),
'#type' => 'checkbox',
'#default_value' => !empty($settings['default']),
'#states' => array(
'visible' => array(
'#panelizer-status' => array(
'checked' => TRUE,
),
),
),
'#description' => t('If checked, a default panel will be utilized for all existing and new entities.'),
);
$form['panelizer']['choice'] = array(
'#title' => t('Allow panel choice'),
'#type' => 'checkbox',
'#default_value' => !empty($settings['choice']),
'#states' => array(
'visible' => array(
'#panelizer-status' => array(
'checked' => TRUE,
),
),
),
'#description' => t('If checked multiple panels can be created and each entity will get a selector to choose which panel to use.'),
);
array_unshift($form['#submit'], 'panelizer_entity_default_bundle_form_submit');
$form_state['panelizer_entity_handler'] = $this;
}