function fieldable_panels_panes_entity_edit_access_page in Fieldable Panels Panes (FPP) 7
Page callback to edit access control of an entity pane.
Parameters
string $op: Either 'edit' or 'view' to determine which type of access.
object $entity: The entity to control access to.
1 string reference to 'fieldable_panels_panes_entity_edit_access_page'
- fieldable_panels_panes_menu in ./
fieldable_panels_panes.module - Implements hook_menu().
File
- includes/
admin.inc, line 207 - Contains administrative pages and functions for fieldable entity panes.
Code
function fieldable_panels_panes_entity_edit_access_page($op, $entity) {
ctools_include('context-access-admin');
// @todo -- add view_access field.
$argument = $op . ':' . $entity->fpid;
ctools_include('object-cache');
// Ensure that if they visit this page fresh, any cached data is removed:
if (empty($_POST)) {
ctools_object_cache_clear('fieldable_panels_panes', $argument);
}
else {
$access = ctools_object_cache_get('fieldable_panels_panes', $argument);
}
if (empty($access)) {
$access = $entity->{$op . '_access'};
}
$form_state = array(
'access' => $access,
'module' => 'fieldable_panels_panes',
'callback argument' => $argument,
// A bug in context-access-admin requires this until it's fixed.
'argument' => $argument,
'contexts' => fieldable_panels_panes_get_base_context($entity),
'no_redirect' => TRUE,
);
$output = drupal_build_form('ctools_access_admin_form', $form_state);
if (!empty($form_state['executed'])) {
ctools_object_cache_clear('fieldable_panels_panes', $argument);
$entity->{$op . '_access'} = $form_state['access'];
fieldable_panels_panes_save($entity);
drupal_set_message(t('The access control has been updated.'));
drupal_goto($_GET['q']);
}
return $output;
}