You are here

public function PanelsPaneController::saveRevision in Fieldable Panels Panes (FPP) 7

Saves an entity revision with the uid of the current user.

Parameters

object $entity: The fully loaded entity object.

int|null $uid: The user's uid for the current revision.

1 call to PanelsPaneController::saveRevision()
PanelsPaneController::save in includes/PanelsPaneController.class.php
Save the given FPP object.

File

includes/PanelsPaneController.class.php, line 233
Contains the controller class for the Fieldable Panel Pane entity.

Class

PanelsPaneController
Entity controller class.

Code

public function saveRevision($entity, array $uid = NULL) {
  if (!isset($uid)) {
    $uid = $GLOBALS['user']->uid;
  }
  $entity->uid = $uid;

  // Update the existing revision if specified.
  if (!empty($entity->vid)) {
    if (module_exists('uuid')) {
      drupal_write_record('fieldable_panels_panes_revision', $entity, 'vuuid');
    }
    else {
      drupal_write_record('fieldable_panels_panes_revision', $entity, 'vid');
    }
  }
  else {

    // Otherwise insert a new revision. This will automatically update $entity
    // to include the vid.
    drupal_write_record('fieldable_panels_panes_revision', $entity);
  }
}