You are here

public function PanelizerEntityDefault::hook_field_attach_submit in Panelizer 7.2

Same name and namespace in other branches
  1. 7.3 plugins/entity/PanelizerEntityDefault.class.php \PanelizerEntityDefault::hook_field_attach_submit()

File

plugins/entity/PanelizerEntityDefault.class.php, line 946
Base class for the Panelizer Entity plugin.

Class

PanelizerEntityDefault
Base class for the Panelizer Entity plugin.

Code

public function hook_field_attach_submit($entity, &$form, &$form_state) {
  list($entity_id, $revision_id, $bundle) = entity_extract_ids($this->entity_type, $entity);
  if (!empty($form_state['panelizer has choice']) && !empty($form_state['values']['panelizer']['name'])) {

    // Guarantee we overwrite any previous settings or non-settings.
    $entity->panelizer = $this
      ->get_default_panelizer_object($bundle, $form_state['values']['panelizer']['name']);
    $entity->panelizer->did = NULL;

    // Ensure original values are maintained:
    $entity->panelizer->entity_id = $form['panelizer']['#entity_id'];
    $entity->panelizer->revision_id = $form['panelizer']['#revision_id'];
  }
}