You are here

public function PanelizerEntityNode::entity_save in Panelizer 7.3

Same name and namespace in other branches
  1. 7.2 plugins/entity/PanelizerEntityNode.class.php \PanelizerEntityNode::entity_save()

Implement the save function for the entity.

Overrides PanelizerEntityInterface::entity_save

File

plugins/entity/PanelizerEntityNode.class.php, line 27
Class for the Panelizer node entity plugin.

Class

PanelizerEntityNode
Panelizer Entity node plugin class.

Code

public function entity_save($entity) {
  if (module_exists('workbench_moderation') && workbench_moderation_node_type_moderated($entity->type)) {
    $live_entity = workbench_moderation_node_live_load($entity);
    if ($live_entity->vid != $entity->vid) {
      $entity->revision = TRUE;
    }
  }
  node_save($entity);

  // Clear page cache. This replaces the need for cache_clear_all() which is
  // normally called by node_form_submit().
  $internal_path = entity_uri('node', $entity);
  $url = url($internal_path['path'], array(
    'absolute' => TRUE,
  ));
  cache_clear_all($url, 'cache_page');
}