function _fape_entity_allows_revisions in Field API Pane Editor (FAPE) 7
Determine if an entity uses revisions.
Return value
An array where the first item is whether or not revisions are supported, and the second item is whether or not the current user has a choice.
Much of this is specific to entity types, so entities that are not nodes that support revisions may not handle this quite correctly without help. We'll put in an alter hook so that support can be added, but we have no confidence anyone will ever use it.
1 call to _fape_entity_allows_revisions()
- fape_field_edit_form in ./
fape.module - Field editing form.
File
- ./
fape.module, line 462 - Adds direct field editing via contextual links.
Code
function _fape_entity_allows_revisions($entity_type, $bundle, $entity) {
$retval = array(
FALSE,
FALSE,
);
switch ($entity_type) {
case 'node':
$node_options = variable_get('node_options_' . $bundle, array(
'status',
'promote',
));
$retval[0] = in_array('revision', $node_options);
$retval[1] = user_access('administer nodes');
break;
default:
$entity_info = entity_get_info($entity_type);
$retval[0] = !empty($entity_info['revision table']);
break;
}
drupal_alter('fape_entity_allow_revisions', $retval);
$entity->revision = $retval[0];
$entity->log = '';
return $retval;
}