You are here

function panelizer_set_status_action in Panelizer 7.3

Same name and namespace in other branches
  1. 7.2 panelizer.module \panelizer_set_status_action()

Executes the panelizer_set_status action.

File

./panelizer.module, line 1568
The Panelizer module attaches panels to entities, providing default panels and allowing each panel to be configured independently by privileged users.

Code

function panelizer_set_status_action($entity, $context) {
  $view_mode = 'page_manager';
  if (isset($context['view_mode'])) {
    $view_mode = $context['view_mode'];
  }
  list($entity_id, $revision_id, $bundle) = entity_extract_ids($context['entity_type'], $entity);
  if (isset($context['panelizer_default'])) {
    $entity->panelizer[$view_mode] = $context['panelizer_default'];
    $entity->panelizer[$view_mode]->did = NULL;

    // Ensure original values are maintained.
    $entity->panelizer[$view_mode]->entity_id = $entity_id;
    $entity->panelizer[$view_mode]->revision_id = $revision_id;
  }
  else {
    $entity->panelizer[$view_mode]->name = NULL;
    $entity->panelizer[$view_mode]->did = NULL;
  }
}