You are here

function fieldable_panels_panes_delete_revision in Fieldable Panels Panes (FPP) 7

Delete a revision for a fieldable panel pane.

Parameters

int $fpid: A fieldable panel pane ID.

int $vid: The revision id to delete.

Return value

bool Indicates whether the object was successfully deleted or not.

1 call to fieldable_panels_panes_delete_revision()
fieldable_panels_panes_entity_delete_revision_form_submit in includes/admin.inc
Execute revision deletion.

File

./fieldable_panels_panes.module, line 1111
Maintains an entity that appears as panel pane content.

Code

function fieldable_panels_panes_delete_revision($fpid, $vid) {
  if ($revision = fieldable_panels_panes_load($fpid, $vid)) {

    // Prevent deleting the current revision.
    $entity = fieldable_panels_panes_load($revision->fpid);
    if (empty($entity) || empty($entity->vid)) {
      return FALSE;
    }
    db_delete('fieldable_panels_panes_revision')
      ->condition('fpid', $revision->fpid)
      ->condition('vid', $revision->vid)
      ->execute();
    field_attach_delete_revision('fieldable_panels_pane', $revision);
    return TRUE;
  }
  return FALSE;
}