123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787 |
- <?php
- /**
- * @file
- * Handle the 'page' task, which creates pages with arbitrary tasks and lets
- * handlers decide how they will be rendered.
- *
- * This creates subtasks and stores them in the page_manager_pages table. These
- * are exportable objects, too.
- *
- * The render callback for this task type has $handler, $page, $contexts as
- * parameters.
- */
- /**
- * Specialized implementation of hook_page_manager_task_tasks(). See api-task.html for
- * more information.
- */
- function page_manager_page_page_manager_tasks() {
- return array(
- 'title' => t('Custom pages'),
- 'description' => t('Administrator created pages that have a URL path, access control and entries in the Drupal menu system.'),
- 'non-exportable' => TRUE,
- 'subtasks' => TRUE,
- 'subtask callback' => 'page_manager_page_subtask',
- 'subtasks callback' => 'page_manager_page_subtasks',
- 'save subtask callback' => 'page_manager_page_save_subtask',
- 'access callback' => 'page_manager_page_access_check',
- 'hook menu' => array(
- 'file' => 'page.admin.inc',
- 'path' => drupal_get_path('module', 'page_manager') . '/plugins/tasks',
- 'function' => 'page_manager_page_menu',
- ),
- 'hook theme' => 'page_manager_page_theme',
- // page only items
- 'task type' => 'page',
- 'page operations' => array(
- array(
- 'title' => ' » ' . t('Create a new page'),
- 'href' => 'admin/structure/pages/add',
- 'html' => TRUE,
- ),
- ),
- 'columns' => array(
- 'storage' => array(
- 'label' => t('Storage'),
- 'class' => 'page-manager-page-storage',
- ),
- ),
- 'page type' => 'custom',
- // context only items
- 'handler type' => 'context',
- 'get arguments' => array(
- 'file' => 'page.admin.inc',
- 'path' => drupal_get_path('module', 'page_manager') . '/plugins/tasks',
- 'function' => 'page_manager_page_get_arguments',
- ),
- 'get context placeholders' => 'page_manager_page_get_contexts',
- 'access restrictions' => 'page_manager_page_access_restrictions',
- 'uses handlers' => TRUE,
- );
- }
- /**
- * Task callback to get all subtasks.
- *
- * Return a list of all subtasks.
- */
- function page_manager_page_subtasks($task) {
- $pages = page_manager_page_load_all($task['name']);
- $return = array();
- foreach ($pages as $name => $page) {
- $return[$name] = page_manager_page_build_subtask($task, $page);
- }
- return $return;
- }
- /**
- * Callback to return a single subtask.
- */
- function page_manager_page_subtask($task, $subtask_id) {
- $page = page_manager_page_load($subtask_id);
- if ($page) {
- return page_manager_page_build_subtask($task, $page);
- }
- }
- /**
- * Call back from the administrative system to save a page.
- *
- * We get the $subtask as created by page_manager_page_build_subtask.
- */
- function page_manager_page_save_subtask($subtask) {
- $page = &$subtask['subtask'];
- // Ensure $page->arguments contains only real arguments:
- $arguments = page_manager_page_get_named_arguments($page->path);
- $args = array();
- foreach ($arguments as $keyword => $position) {
- if (isset($page->arguments[$keyword])) {
- $args[$keyword] = $page->arguments[$keyword];
- }
- else {
- $args[$keyword] = array(
- 'id' => '',
- 'identifier' => '',
- 'argument' => '',
- 'settings' => array(),
- );
- }
- }
- page_manager_page_recalculate_arguments($page);
- // Create a real object from the cache
- page_manager_page_save($page);
- // Check to see if we should make this the site frontpage.
- if (!empty($page->make_frontpage)) {
- $path = array();
- foreach (explode('/', $page->path) as $bit) {
- if ($bit[0] != '!') {
- $path[] = $bit;
- }
- }
- $path = implode('/', $path);
- $front = variable_get('site_frontpage', 'node');
- if ($path != $front) {
- variable_set('site_frontpage', $path);
- }
- }
- }
- /**
- * Build a subtask array for a given page.
- */
- function page_manager_page_build_subtask($task, $page) {
- $operations = array();
- $operations['settings'] = array(
- 'type' => 'group',
- 'class' => array('operations-settings'),
- 'title' => t('Settings'),
- 'children' => array(),
- );
- $settings = &$operations['settings']['children'];
- $settings['basic'] = array(
- 'title' => t('Basic'),
- 'description' => t('Edit name, path and other basic settings for the page.'),
- 'form' => 'page_manager_page_form_basic',
- );
- $arguments = page_manager_page_get_named_arguments($page->path);
- if ($arguments) {
- $settings['argument'] = array(
- 'title' => t('Arguments'),
- 'description' => t('Set up contexts for the arguments on this page.'),
- 'form' => 'page_manager_page_form_argument',
- );
- }
- $settings['access'] = array(
- 'title' => t('Access'),
- 'description' => t('Control what users can access this page.'),
- 'admin description' => t('Access rules are used to test if the page is accessible and any menu items associated with it are visible.'),
- 'form' => 'page_manager_page_form_access',
- );
- $settings['menu'] = array(
- 'title' => t('Menu'),
- 'description' => t('Provide this page a visible menu or a menu tab.'),
- 'form' => 'page_manager_page_form_menu',
- );
- $operations['actions']['children']['clone'] = array(
- 'title' => t('Clone'),
- 'description' => t('Make a copy of this page'),
- 'form' => 'page_manager_page_form_clone',
- );
- $operations['actions']['children']['export'] = array(
- 'title' => t('Export'),
- 'description' => t('Export this page as code that can be imported or embedded into a module.'),
- 'form' => 'page_manager_page_form_export',
- );
- if ($page->export_type == (EXPORT_IN_CODE | EXPORT_IN_DATABASE)) {
- $operations['actions']['children']['delete'] = array(
- 'title' => t('Revert'),
- 'description' => t('Remove all changes to this page and revert to the version in code.'),
- 'form' => 'page_manager_page_form_delete',
- );
- }
- else if ($page->export_type != EXPORT_IN_CODE) {
- $operations['actions']['children']['delete'] = array(
- 'title' => t('Delete'),
- 'description' => t('Remove this page from your system completely.'),
- 'form' => 'page_manager_page_form_delete',
- );
- }
- $subtask = array(
- 'name' => $page->name,
- 'admin title' => check_plain($page->admin_title),
- 'admin description' => filter_xss_admin($page->admin_description),
- 'admin summary' => 'page_manager_page_admin_summary',
- 'admin path' => $page->path,
- 'admin type' => t('Custom'),
- 'subtask' => $page,
- 'operations' => $operations,
- 'operations include' => array(
- 'file' => 'page.admin.inc',
- 'path' => drupal_get_path('module', 'page_manager') . '/plugins/tasks',
- ),
- 'single task' => empty($page->multiple),
- 'row class' => empty($page->disabled) ? 'page-manager-enabled' : 'page-manager-disabled',
- 'storage' => $page->type == t('Default') ? t('In code') : $page->type,
- 'disabled' => !empty($page->disabled),
- // This works for both enable AND disable
- 'enable callback' => 'page_manager_page_enable',
- );
- // default handlers may appear from a default subtask.
- if (isset($page->default_handlers)) {
- $subtask['default handlers'] = $page->default_handlers;
- }
- return $subtask;
- }
- /**
- * Delegated implementation of hook_theme().
- */
- function page_manager_page_theme(&$items, $task) {
- $base = array(
- 'file' => 'page.admin.inc',
- 'path' => drupal_get_path('module', 'page_manager') . '/plugins/tasks',
- );
- $items['page_manager_page_form_argument_table'] = $base + array(
- 'render element' => 'form',
- );
- $items['page_manager_page_lock'] = $base + array(
- 'variables' => array('lock' => array(), 'task_name' => NULL),
- );
- $items['page_manager_page_changed'] = $base + array(
- 'variables' => array(),
- );
- }
- // --------------------------------------------------------------------------
- // Page execution functions
- /**
- * Execute a page task.
- *
- * This is the callback to entries in the Drupal menu system created by the
- * page task.
- *
- * @param $subtask_id
- * The name of the page task used.
- * @param ...
- * A number of context objects as specified by the user when
- * creating named arguments in the path.
- */
- function page_manager_page_execute($subtask_id) {
- $page = page_manager_page_load($subtask_id);
- $task = page_manager_get_task($page->task);
- $subtask = page_manager_get_task_subtask($task, $subtask_id);
- // Turn the contexts into a properly keyed array.
- $contexts = array();
- $args = array();
- foreach (func_get_args() as $count => $arg) {
- if (is_object($arg) && get_class($arg) == 'ctools_context') {
- $contexts[$arg->id] = $arg;
- $args[] = $arg->original_argument;
- }
- else if ($count) {
- $args[] = $arg;
- }
- }
- $count = 0;
- $names = page_manager_page_get_named_arguments($page->path);
- $bits = explode('/', $page->path);
- if ($page->arguments) {
- foreach ($page->arguments as $name => $argument) {
- // Optional arguments must be converted to contexts too, if they exist.
- if ($bits[$names[$name]][0] == '!') {
- ctools_include('context');
- $argument['keyword'] = $name;
- if (isset($args[$count])) {
- // Hack: use a special argument config variable to learn if we need
- // to use menu_tail style behavior:
- if (empty($argument['settings']['use_tail'])) {
- $value = $args[$count];
- }
- else {
- $value = implode('/', array_slice($args, $count));
- }
- $context = ctools_context_get_context_from_argument($argument, $value);
- }
- else {
- // make sure there is a placeholder context for missing optional contexts.
- $context = ctools_context_get_context_from_argument($argument, NULL, TRUE);
- // Force the title to blank for replacements
- }
- if ($context) {
- $contexts[$context->id] = $context;
- }
- }
- $count++;
- }
- }
- if ($function = ctools_plugin_get_function($task, 'page callback')) {
- return call_user_func_array($function, array($page, $contexts, $args));
- }
- ctools_include('context-task-handler');
- $output = ctools_context_handler_render($task, $subtask, $contexts, $args);
- if ($output === FALSE) {
- return MENU_NOT_FOUND;
- }
- return $output;
- }
- // --------------------------------------------------------------------------
- // Context type callbacks
- /**
- * Return a list of arguments used by this task.
- */
- function page_manager_page_get_arguments($task, $subtask) {
- return _page_manager_page_get_arguments($subtask['subtask']);
- }
- function _page_manager_page_get_arguments($page) {
- $arguments = array();
- if (!empty($page->arguments)) {
- foreach ($page->arguments as $keyword => $argument) {
- if (isset($argument['name'])) {
- $argument['keyword'] = $keyword;
- $arguments[$keyword] = $argument;
- }
- }
- }
- return $arguments;
- }
- /**
- * Get a group of context placeholders for the arguments.
- */
- function page_manager_page_get_contexts($task, $subtask) {
- ctools_include('context');
- return ctools_context_get_placeholders_from_argument(page_manager_page_get_arguments($task, $subtask));
- }
- /**
- * Return a list of arguments used by this task.
- */
- function page_manager_page_access_restrictions($task, $subtask, $contexts) {
- $page = $subtask['subtask'];
- return ctools_access_add_restrictions($page->access, $contexts);
- }
- // --------------------------------------------------------------------------
- // Page task database info.
- /**
- * Create a new page with defaults appropriately set from schema.
- */
- function page_manager_page_new() {
- ctools_include('export');
- return ctools_export_new_object('page_manager_pages');
- }
- /**
- * Load a single page subtask.
- */
- function page_manager_page_load($name) {
- ctools_include('export');
- $result = ctools_export_load_object('page_manager_pages', 'names', array($name));
- if (isset($result[$name])) {
- return $result[$name];
- }
- }
- /**
- * Load all page subtasks.
- */
- function page_manager_page_load_all($task = NULL) {
- ctools_include('export');
- if (empty($task)) {
- return ctools_export_load_object('page_manager_pages');
- }
- else {
- return ctools_export_load_object('page_manager_pages', 'conditions', array('task' => $task));
- }
- }
- /**
- * Write a page subtask to the database.
- */
- function page_manager_page_save(&$page) {
- $update = (isset($page->pid)) ? array('pid') : array();
- $task = page_manager_get_task($page->task);
- if ($function = ctools_plugin_get_function($task, 'save')) {
- $function($page, $update);
- }
- drupal_write_record('page_manager_pages', $page, $update);
- // If this was a default page we may need to write default task
- // handlers that we provided as well.
- if (!$update && isset($page->default_handlers)) {
- $handlers = page_manager_load_task_handlers(page_manager_get_task('page'), $page->name);
- foreach ($page->default_handlers as $name => $handler) {
- if (!isset($handlers[$name]) || !($handlers[$name]->export_type & EXPORT_IN_DATABASE)) {
- // Make sure this is right, as exports can wander a bit.
- $handler->subtask = $page->name;
- page_manager_save_task_handler($handler);
- }
- }
- }
- return $page;
- }
- /**
- * Remove a page subtask.
- */
- function page_manager_page_delete($page) {
- $task = page_manager_get_task($page->task);
- if ($function = ctools_plugin_get_function($task, 'delete')) {
- $function($page);
- }
- if (!empty($task['uses handlers'])) {
- $handlers = page_manager_load_task_handlers($task, $page->name);
- foreach ($handlers as $handler) {
- page_manager_delete_task_handler($handler);
- }
- }
- db_delete('page_manager_pages')
- ->condition('name', $page->name)
- ->execute();
- // Make sure that the cache is reset so that the menu rebuild does not
- // rebuild this page again.
- ctools_include('export');
- ctools_export_load_object_reset('page_manager_pages');
- menu_rebuild();
- }
- /**
- * Export a page subtask.
- */
- function page_manager_page_export($page, $with_handlers = FALSE, $indent = '') {
- $task = page_manager_get_task($page->task);
- $append = '';
- if ($function = ctools_plugin_get_function($task, 'export')) {
- $append = $function($page, $indent);
- }
- ctools_include('export');
- $output = ctools_export_object('page_manager_pages', $page, $indent);
- $output .= $append;
- if ($with_handlers) {
- if (is_array($with_handlers)) {
- $handlers = $with_handlers;
- }
- else {
- $handlers = page_manager_load_task_handlers(page_manager_get_task('page'), $page->name);
- }
- $output .= $indent . '$page->default_handlers = array();' . "\n";
- foreach ($handlers as $handler) {
- $output .= page_manager_export_task_handler($handler, $indent);
- $output .= $indent . '$page->default_handlers[$handler->name] = $handler;' . "\n";
- }
- }
- return $output;
- }
- /**
- * Get a list of named arguments in a page manager path.
- *
- * @param $path
- * A normal Drupal path.
- *
- * @return
- * An array of % marked variable arguments, keyed by the argument's name.
- * The value will be the position of the argument so that it can easily
- * be found. Items with a position of -1 have multiple positions.
- */
- function page_manager_page_get_named_arguments($path) {
- $arguments = array();
- $bits = explode('/', $path);
- foreach ($bits as $position => $bit) {
- if ($bit && ($bit[0] == '%' || $bit[0] == '!')) {
- // special handling for duplicate path items and substr to remove the %
- $arguments[substr($bit, 1)] = isset($arguments[$bit]) ? -1 : $position;
- }
- }
- return $arguments;
- }
- /**
- * Load a context from an argument for a given page task.
- *
- * Helper function for pm_arg_load(), which is in page_manager.module because
- * drupal's menu system does not allow loader functions to reside in separate
- * files.
- *
- * @param $value
- * The incoming argument value.
- * @param $subtask
- * The subtask id.
- * @param $argument
- * The numeric position of the argument in the path, counting from 0.
- *
- * @return
- * A context item if one is configured, the argument if one is not, or
- * FALSE if restricted or invalid.
- */
- function _pm_arg_load($value, $subtask, $argument) {
- $page = page_manager_page_load($subtask);
- if (!$page) {
- return FALSE;
- }
- $path = explode('/', $page->path);
- if (empty($path[$argument])) {
- return FALSE;
- }
- $keyword = substr($path[$argument], 1);
- if (empty($page->arguments[$keyword])) {
- return $value;
- }
- $page->arguments[$keyword]['keyword'] = $keyword;
- ctools_include('context');
- $context = ctools_context_get_context_from_argument($page->arguments[$keyword], $value);
- // convert false equivalents to false.
- return $context ? $context : FALSE;
- }
- /**
- * Provide a nice administrative summary of the page so an admin can see at a
- * glance what this page does and how it is configured.
- */
- function page_manager_page_admin_summary($task, $subtask) {
- $task_name = page_manager_make_task_name($task['name'], $subtask['name']);
- $page = $subtask['subtask'];
- $output = '';
- $rows = array();
- $rows[] = array(
- array('class' => array('page-summary-label'), 'data' => t('Storage')),
- array('class' => array('page-summary-data'), 'data' => $subtask['storage']),
- array('class' => array('page-summary-operation'), 'data' => ''),
- );
- if (!empty($page->disabled)) {
- $link = l(t('Enable'), page_manager_edit_url($task_name, array('handlers', $page->name, 'actions', 'enable')));
- $text = t('Disabled');
- }
- else {
- $link = l(t('Disable'), page_manager_edit_url($task_name, array('handlers', $page->name, 'actions', 'disable')));
- $text = t('Enabled');
- }
- $rows[] = array(
- array('class' => array('page-summary-label'), 'data' => t('Status')),
- array('class' => array('page-summary-data'), 'data' => $text),
- array('class' => array('page-summary-operation'), 'data' => $link),
- );
- $path = array();
- foreach (explode('/', $page->path) as $bit) {
- if ($bit[0] != '!') {
- $path[] = $bit;
- }
- }
- $path = implode('/', $path);
- $front = variable_get('site_frontpage', 'node');
- $link = l(t('Edit'), page_manager_edit_url($task_name, array('settings', 'basic')));
- $message = '';
- if ($path == $front) {
- $message = t('This is your site home page.');
- }
- else if (!empty($page->make_frontpage)) {
- $message = t('This page is set to become your site home page.');
- }
- if ($message) {
- $rows[] = array(
- array('class' => array('page-summary-data'), 'data' => $message, 'colspan' => 2),
- array('class' => array('page-summary-operation'), 'data' => $link),
- );
- }
- if (strpos($path, '%') === FALSE) {
- $path = l('/' . $page->path, $path);
- }
- else {
- $path = '/' . $page->path;
- }
- $rows[] = array(
- array('class' => array('page-summary-label'), 'data' => t('Path')),
- array('class' => array('page-summary-data'), 'data' => $path),
- array('class' => array('page-summary-operation'), 'data' => $link),
- );
- if (empty($access['plugins'])) {
- $access['plugins'] = array();
- }
- $contexts = page_manager_page_get_contexts($task, $subtask);
- $access = ctools_access_group_summary($page->access, $contexts);
- if ($access) {
- $access = t('Accessible only if @conditions.', array('@conditions' => $access));
- }
- else {
- $access = t('This page is publicly accessible.');
- }
- $link = l(t('Edit'), page_manager_edit_url($task_name, array('settings', 'access')));
- $rows[] = array(
- array('class' => array('page-summary-label'), 'data' => t('Access')),
- array('class' => array('page-summary-data'), 'data' => $access),
- array('class' => array('page-summary-operation'), 'data' => $link),
- );
- $menu_options = array(
- 'none' => t('No menu entry.'),
- 'normal' => t('Normal menu entry.'),
- 'tab' => t('Menu tab.'),
- 'default tab' => t('Default menu tab.'),
- 'action' => t('Local action'),
- );
- if (!empty($page->menu)) {
- $menu = $menu_options[$page->menu['type']];
- if ($page->menu['type'] != 'none') {
- $menu .= ' ' . t('Title: %title.', array('%title' => $page->menu['title']));
- switch ($page->menu['type']) {
- case 'default tab':
- $menu .= ' ' . t('Parent title: %title.', array('%title' => $page->menu['parent']['title']));
- break;
- case 'normal':
- if (module_exists('menu')) {
- $menus = menu_get_menus();
- $menu .= ' ' . t('Menu block: %title.', array('%title' => $menus[$page->menu['name']]));
- }
- break;
- }
- }
- }
- else {
- $menu = t('No menu entry');
- }
- $link = l(t('Edit'), page_manager_edit_url($task_name, array('settings', 'menu')));
- $rows[] = array(
- array('class' => array('page-summary-label'), 'data' => t('Menu')),
- array('class' => array('page-summary-data'), 'data' => $menu),
- array('class' => array('page-summary-operation'), 'data' => $link),
- );
- $output .= theme('table', array('rows' => $rows, 'attributes' => array('id' => 'page-manager-page-summary')));
- return $output;
- }
- /**
- * Callback to enable/disable the page from the UI.
- */
- function page_manager_page_enable(&$cache, $status) {
- $page = &$cache->subtask['subtask'];
- ctools_include('export');
- ctools_export_set_object_status($page, $status);
- $page->disabled = FALSE;
- }
- /**
- * Recalculate the arguments when something like the path changes.
- */
- function page_manager_page_recalculate_arguments(&$page) {
- // Ensure $page->arguments contains only real arguments:
- $arguments = page_manager_page_get_named_arguments($page->path);
- $args = array();
- foreach ($arguments as $keyword => $position) {
- if (isset($page->arguments[$keyword])) {
- $args[$keyword] = $page->arguments[$keyword];
- }
- else {
- $args[$keyword] = array(
- 'id' => '',
- 'identifier' => '',
- 'argument' => '',
- 'settings' => array(),
- );
- }
- }
- $page->arguments = $args;
- }
- /**
- * When adding or cloning a new page, this creates a new page cache
- * and adds our page to it.
- *
- * This does not check to see if the existing cache is already locked.
- * This must be done beforehand.
- *
- * @param &$page
- * The page to create.
- * @param &$cache
- * The cache to use. If the cache has any existing task handlers,
- * they will be marked for deletion. This may be a blank object.
- */
- function page_manager_page_new_page_cache(&$page, &$cache) {
- // Does a page already exist? If so, we are overwriting it so
- // take its pid.
- if (!empty($cache->subtask) && !empty($cache->subtask['subtask']) && !empty($cache->subtask['subtask']->pid)) {
- $page->pid = $cache->subtask['subtask']->pid;
- }
- else {
- $cache->new = TRUE;
- }
- $cache->task_name = page_manager_make_task_name('page', $page->name);
- $cache->task_id = 'page';
- $cache->task = page_manager_get_task('page');
- $cache->subtask_id = $page->name;
- $page->export_type = EXPORT_IN_DATABASE;
- $page->type = t('Normal');
- $cache->subtask = page_manager_page_build_subtask($cache->task, $page);
- if (isset($cache->handlers)) {
- foreach($cache->handlers as $id => $handler) {
- $cache->handler_info[$id]['changed'] = PAGE_MANAGER_CHANGED_DELETED;
- }
- }
- else {
- $cache->handlers = array();
- $cache->handler_info = array();
- }
- if (!empty($page->default_handlers)) {
- foreach ($page->default_handlers as $id => $handler) {
- page_manager_handler_add_to_page($cache, $handler);
- }
- }
- $cache->locked = FALSE;
- $cache->changed = TRUE;
- }
- /**
- * Callback to determine if a page is accessible.
- *
- * @param $task
- * The task plugin.
- * @param $subtask_id
- * The subtask id
- * @param $contexts
- * The contexts loaded for the task.
- * @return
- * TRUE if the current user can access the page.
- */
- function page_manager_page_access_check($task, $subtask_id, $contexts) {
- $page = page_manager_page_load($subtask_id);
- return ctools_access($page->access, $contexts);
- }
|