function panelizer_default_access_page in Panelizer 7.3
Same name and namespace in other branches
- 7.2 includes/admin.inc \panelizer_default_access_page()
Determine edit access for this panelizer default.
2 string references to 'panelizer_default_access_page'
- PanelizerEntityDefault::add_admin_links in plugins/
entity/ PanelizerEntityDefault.class.php - Helper function to add administrative menu items into an entity's already existing structure.
- panelizer_admin_hook_menu in includes/
admin.inc - Delegated hook_menu for admin
File
- includes/
admin.inc, line 394 - Contains administrative forms and settings.
Code
function panelizer_default_access_page($handler, $bundle, $name, $view_mode) {
if (is_string($handler)) {
$handler = panelizer_entity_plugin_get_handler($handler);
}
if ($view_mode) {
$bundle .= '.' . $view_mode;
}
$panelizer = $handler
->get_default_panelizer_object($bundle, $name);
if (empty($panelizer)) {
return t('No default display has been configured for this view mode.');
}
$argument = $name;
ctools_include('context-access-admin');
ctools_include('object-cache');
// Ensure that if they visit this page fresh, any cached data is removed:
if (empty($_POST)) {
ctools_object_cache_clear('panelizer_access', $argument);
}
else {
$access = ctools_object_cache_get('panelizer_access', $argument);
}
if (empty($access)) {
$access = $panelizer->access;
}
if (!is_array($access)) {
$access = array();
}
$form_state = array(
'access' => $access,
'module' => 'panelizer',
'callback argument' => $argument,
// A bug in context-access-admin requires this until it's fixed.
'argument' => $argument,
'contexts' => $handler
->get_contexts($panelizer),
'no_redirect' => TRUE,
);
$output = drupal_build_form('ctools_access_admin_form', $form_state);
if (!empty($form_state['executed'])) {
ctools_object_cache_clear('panelizer_access', $argument);
$panelizer->access = $form_state['access'];
ctools_export_crud_save('panelizer_defaults', $panelizer);
drupal_set_message(t('The access settings have been updated.'));
drupal_goto($_GET['q']);
}
return $output;
}