public function PanelizerEntityConfigPages::hook_field_attach_submit in Config Pages 7
Implements hook_field_attach_submit().
File
- plugins/
panelizer/ entity/ PanelizerEntityConfigPages.class.php, line 64 - Class definition.
Class
- PanelizerEntityConfigPages
- Panelizer class for config pages.
Code
public function hook_field_attach_submit($entity, &$form, &$form_state) {
// Save paragraph item panelizer settings.
if (!empty($form_state['panelizer has choice'])) {
list($entity_id, $revision_id, $bundle) = entity_extract_ids($this->entity_type, $entity);
foreach ($this->plugin['view modes'] as $view_mode => $view_mode_info) {
if (isset($form['#parents']) && drupal_array_nested_key_exists($form_state['values'], $form['#parents'])) {
$values = drupal_array_get_nested_value($form_state['values'], $form['#parents']);
if (isset($values['panelizer'][$view_mode]['name'])) {
$entity->panelizer[$view_mode] = clone $this
->get_default_panelizer_object($bundle . '.' . $view_mode, $values['panelizer'][$view_mode]['name']);
if (!empty($entity->panelizer[$view_mode])) {
$entity->panelizer[$view_mode]->did = NULL;
// Ensure original values are maintained, if they exist.
if (isset($form['panelizer'][$view_mode]['name'])) {
$entity->panelizer[$view_mode]->entity_id = $form['panelizer'][$view_mode]['name']['#entity_id'];
$entity->panelizer[$view_mode]->revision_id = $form['panelizer'][$view_mode]['name']['#revision_id'];
}
}
}
}
}
}
}