updated etxlink, ctools, colorbox, computed_field
This commit is contained in:
@@ -100,7 +100,7 @@ body form#page-manager-list-pages-form {
|
||||
|
||||
#page-manager-edit .page-manager-edit-operations li {
|
||||
list-style: none;
|
||||
background: #F6F6F6;
|
||||
background: #f6f6f6;
|
||||
border-top: 1px solid #aaa;
|
||||
border-left: 1px solid #aaa;
|
||||
border-right: 1px solid #aaa;
|
||||
@@ -111,7 +111,7 @@ body form#page-manager-list-pages-form {
|
||||
|
||||
#page-manager-edit .page-manager-edit-operations li.active,
|
||||
#page-manager-edit .page-manager-edit-operations li.active-group .page-manager-group-title {
|
||||
background: #FFFFFF url(../images/arrow-active.png) no-repeat scroll right center;
|
||||
background: #ffffff url(../images/arrow-active.png) no-repeat scroll right center;
|
||||
}
|
||||
|
||||
#page-manager-edit .page-manager-edit-operations li.changed,
|
||||
@@ -123,7 +123,7 @@ body form#page-manager-list-pages-form {
|
||||
/** provide a reset for non active stray paths */
|
||||
#page-manager-edit .page-manager-edit-operations li.active-group li.not-active .page-manager-group-title,
|
||||
#page-manager-edit .page-manager-edit-operations li.changed-group li.not-changed .page-manager-group-title {
|
||||
background: #F6F6F6;
|
||||
background: #f6f6f6;
|
||||
}
|
||||
|
||||
#page-manager-edit .page-manager-edit-operations li.active {
|
||||
@@ -132,7 +132,7 @@ body form#page-manager-list-pages-form {
|
||||
|
||||
#page-manager-edit .page-manager-edit-operations li.active a,
|
||||
#page-manager-edit .page-manager-edit-operations li.active a:hover {
|
||||
background: #FFFFFF url(../images/arrow-active.png) no-repeat scroll right center;
|
||||
background: #ffffff url(../images/arrow-active.png) no-repeat scroll right center;
|
||||
color: #000000;
|
||||
font-weight: bold;
|
||||
}
|
||||
@@ -271,8 +271,8 @@ body form#page-manager-list-pages-form {
|
||||
#page-manager-edit .actions li a {
|
||||
display: block;
|
||||
padding: 0.2em 0.5em;
|
||||
color:#0062A0;
|
||||
background-color: #F6F6F6;
|
||||
color: #0062a0;
|
||||
background-color: #f6f6f6;
|
||||
}
|
||||
|
||||
#page-manager-edit .page-manager-changed {
|
||||
|
@@ -631,7 +631,7 @@ function page_manager_get_operations($page, $operations = NULL) {
|
||||
if (isset($plugin['add features'][$id])) {
|
||||
$result['actions']['children']['configure']['form']['order'][$id] = $plugin['add features'][$id];
|
||||
}
|
||||
else if (isset($plugin['required forms'][$id])) {
|
||||
elseif (isset($plugin['required forms'][$id])) {
|
||||
$result['actions']['children']['configure']['form']['order'][$id] = $plugin['required forms'][$id];
|
||||
}
|
||||
}
|
||||
@@ -732,7 +732,7 @@ function page_manager_get_handler_operations(&$page) {
|
||||
),
|
||||
);
|
||||
}
|
||||
else if ($handler->export_type != EXPORT_IN_CODE) {
|
||||
elseif ($handler->export_type != EXPORT_IN_CODE) {
|
||||
$actions['delete'] = array(
|
||||
'title' => t('Delete'),
|
||||
'description' => t('Remove this variant from the page completely.'),
|
||||
@@ -1144,7 +1144,7 @@ function page_manager_render_operations(&$page, $operations, $active_trail, $att
|
||||
if ($id == $first) {
|
||||
$class[] = 'operation-first';
|
||||
}
|
||||
else if ($id == $last) {
|
||||
elseif ($id == $last) {
|
||||
$class[] = 'operation-last';
|
||||
}
|
||||
|
||||
|
@@ -3,11 +3,11 @@ description = Provides a UI and API to manage pages within the site.
|
||||
core = 7.x
|
||||
dependencies[] = ctools
|
||||
package = Chaos tool suite
|
||||
version = CTOOLS_MODULE_VERSION
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-11-22
|
||||
version = "7.x-1.12"
|
||||
files[] = tests/head_links.test
|
||||
|
||||
; Information added by Drupal.org packaging script on 2019-02-08
|
||||
version = "7.x-1.15"
|
||||
core = "7.x"
|
||||
project = "ctools"
|
||||
datestamp = "1479787162"
|
||||
|
||||
datestamp = "1549603691"
|
||||
|
@@ -205,7 +205,7 @@ function page_manager_menu_alter(&$items) {
|
||||
if ($function = ctools_plugin_get_function($task, 'hook menu alter')) {
|
||||
$function($items, $task);
|
||||
}
|
||||
// let the subtasks alter the menu items too.
|
||||
// Let the subtasks alter the menu items too.
|
||||
foreach (page_manager_get_task_subtasks($task) as $subtask_id => $subtask) {
|
||||
if ($function = ctools_plugin_get_function($subtask, 'hook menu alter')) {
|
||||
$function($items, $subtask);
|
||||
@@ -240,7 +240,7 @@ function page_manager_menu_alter(&$items) {
|
||||
return $items;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Implements hook_theme()
|
||||
*/
|
||||
function page_manager_theme() {
|
||||
@@ -333,7 +333,7 @@ function page_manager_get_page_cache($task_name) {
|
||||
}
|
||||
}
|
||||
else {
|
||||
// ensure the task is loaded.
|
||||
// Ensure the task is loaded.
|
||||
page_manager_get_task($cache->task_id);
|
||||
}
|
||||
|
||||
@@ -390,11 +390,10 @@ function page_manager_save_page_cache($cache) {
|
||||
foreach ($cache->handler_info as $id => $info) {
|
||||
$handler = &$cache->handlers[$id];
|
||||
// If it has been marked for deletion, delete it.
|
||||
|
||||
if ($info['changed'] & PAGE_MANAGER_CHANGED_DELETED) {
|
||||
page_manager_delete_task_handler($handler);
|
||||
}
|
||||
// If it has been somehow edited (or added), write the cached version
|
||||
// If it has been somehow edited (or added), write the cached version.
|
||||
elseif ($info['changed'] & PAGE_MANAGER_CHANGED_CACHED) {
|
||||
// Make sure we get updated weight from the form for this.
|
||||
$handler->weight = $info['weight'];
|
||||
@@ -427,7 +426,7 @@ function page_manager_save_page_cache($cache) {
|
||||
* Menu callback to load a page manager cache object for menu callbacks.
|
||||
*/
|
||||
function page_manager_cache_load($task_name) {
|
||||
// load context plugin as there may be contexts cached here.
|
||||
// Load context plugin as there may be contexts cached here.
|
||||
ctools_include('context');
|
||||
return page_manager_get_page_cache($task_name);
|
||||
}
|
||||
@@ -500,7 +499,6 @@ function page_manager_handler_add_to_page(&$page, &$handler, $title = NULL) {
|
||||
//
|
||||
// This includes fetching plugins and plugin info as well as specialized
|
||||
// fetch methods to get groups of task handlers per task.
|
||||
|
||||
/**
|
||||
* Load a single task handler by name.
|
||||
*
|
||||
@@ -582,7 +580,7 @@ function page_manager_get_default_task_handlers($task, $subtask_id) {
|
||||
$handlers = $subtask['default handlers'];
|
||||
}
|
||||
}
|
||||
else if (isset($task['default handlers'])) {
|
||||
elseif (isset($task['default handlers'])) {
|
||||
$handlers = $task['default handlers'];
|
||||
}
|
||||
|
||||
@@ -604,6 +602,7 @@ function page_manager_get_default_task_handlers($task, $subtask_id) {
|
||||
* A list of handlers provided by the default task.
|
||||
* @param $name
|
||||
* Which handler to compare.
|
||||
*
|
||||
* @return
|
||||
* Which handler to use, if any. May be NULL.
|
||||
*/
|
||||
@@ -615,10 +614,10 @@ function page_manager_compare_task_handlers($result, $handlers, $name) {
|
||||
$handlers[$name]->export_type = EXPORT_IN_CODE;
|
||||
return $handlers[$name];
|
||||
}
|
||||
else if (isset($result[$name]) && !isset($handlers[$name])) {
|
||||
elseif (isset($result[$name]) && !isset($handlers[$name])) {
|
||||
return $result[$name];
|
||||
}
|
||||
else if (isset($result[$name]) && isset($handlers[$name])) {
|
||||
elseif (isset($result[$name]) && isset($handlers[$name])) {
|
||||
if ($result[$name]->export_type & EXPORT_IN_DATABASE) {
|
||||
$result[$name]->type = t('Overridden');
|
||||
$result[$name]->export_type = $result[$name]->export_type | EXPORT_IN_CODE;
|
||||
@@ -776,9 +775,8 @@ function page_manager_export_task_handler_load($name) {
|
||||
function page_manager_new_task_handler($plugin) {
|
||||
// Generate a unique name. Unlike most named objects, we don't let people choose
|
||||
// names for task handlers because they mostly don't make sense.
|
||||
|
||||
// Create a new, empty handler object.
|
||||
$handler = new stdClass;
|
||||
$handler = new stdClass();
|
||||
$handler->title = $plugin['title'];
|
||||
$handler->task = NULL;
|
||||
$handler->subtask = NULL;
|
||||
@@ -797,7 +795,7 @@ function page_manager_new_task_handler($plugin) {
|
||||
if (is_array($plugin['default conf'])) {
|
||||
$handler->conf = $plugin['default conf'];
|
||||
}
|
||||
else if (function_exists($plugin['default conf'])) {
|
||||
elseif (function_exists($plugin['default conf'])) {
|
||||
$handler->conf = $plugin['default conf']($handler);
|
||||
}
|
||||
}
|
||||
@@ -823,7 +821,6 @@ function page_manager_update_task_handler_weight($handler, $weight) {
|
||||
->execute();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Shortcut function to get task plugins.
|
||||
*/
|
||||
@@ -1200,7 +1197,7 @@ function page_manager_page_manager_pages_to_hook_code($names = array(), $name =
|
||||
$code .= " */\n";
|
||||
$code .= "function " . $name . "_{$export['default hook']}() {\n";
|
||||
foreach ($objects as $object) {
|
||||
// Have to implement our own because this export func sig requires it
|
||||
// Have to implement our own because this export func sig requires it.
|
||||
$code .= $export['export callback']($object, TRUE, ' ');
|
||||
$code .= " \${$export['identifier']}s['" . check_plain($object->{$export['key']}) . "'] = \${$export['identifier']};\n\n";
|
||||
}
|
||||
@@ -1310,7 +1307,7 @@ function page_manager_addressable_content($address, $type) {
|
||||
$arguments = explode('..', $arguments);
|
||||
}
|
||||
else {
|
||||
// implode does not return an empty array on an empty
|
||||
// Implode does not return an empty array on an empty
|
||||
// string so do it specifically.
|
||||
$arguments = array();
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
$plugin = array(
|
||||
// cache plugins are the rare plugin types that have no real UI but
|
||||
// Cache plugins are the rare plugin types that have no real UI but
|
||||
// we're providing a title just in case.
|
||||
'title' => t('Page manager context'),
|
||||
'cache get' => 'page_manager_cache_page_manager_context_cache_get',
|
||||
@@ -46,7 +46,7 @@ function page_manager_cache_page_manager_context_cache_set($data, $key, $object)
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy temporary data from the page manager cache
|
||||
* Copy temporary data from the page manager cache.
|
||||
*/
|
||||
function page_manager_cache_page_manager_context_cache_finalize($data, $key, $object) {
|
||||
// Statically cached so there shouldn't be any worries. It's an object so
|
||||
|
@@ -2,14 +2,13 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* This is the task handler plugin to handle generating 403, 404, 301 and 302
|
||||
* response codes.
|
||||
*/
|
||||
|
||||
// Plugin definition
|
||||
// Plugin definition.
|
||||
$plugin = array(
|
||||
// is a 'context' handler type, meaning it supports the API of the
|
||||
// Is a 'context' handler type, meaning it supports the API of the
|
||||
// context handlers provided by ctools context plugins.
|
||||
'handler type' => 'context',
|
||||
'visible' => TRUE, // may be added up front.
|
||||
@@ -121,7 +120,7 @@ function page_manager_http_response_admin_summary($handler, $task, $subtask, $pa
|
||||
ctools_include('context');
|
||||
ctools_include('context-task-handler');
|
||||
|
||||
// Get the operations
|
||||
// Get the operations.
|
||||
$operations = page_manager_get_operations($page);
|
||||
|
||||
// Get operations for just this handler.
|
||||
@@ -190,7 +189,7 @@ function page_manager_http_response_admin_summary($handler, $task, $subtask, $pa
|
||||
|
||||
$output .= '<div class="clearfix">';
|
||||
if ($show_title) {
|
||||
$output .= '<div class="handler-title clearfix">';
|
||||
$output .= '<div class="handler-title clearfix">';
|
||||
$output .= '<div class="actions handler-actions">' . $rendered_operations['actions'] . '</div>';
|
||||
$output .= '<span class="title-label">' . $title . '</span>';
|
||||
}
|
||||
@@ -215,7 +214,7 @@ function page_manager_http_response_title($handler, $task, $subtask) {
|
||||
}
|
||||
|
||||
/**
|
||||
* General settings for the panel
|
||||
* General settings for the panel.
|
||||
*/
|
||||
function page_manager_http_response_edit_settings($form, &$form_state) {
|
||||
ctools_include('page_manager.admin', 'page_manager', '');
|
||||
@@ -302,7 +301,7 @@ function page_manager_http_response_render($handler, $base_contexts, $args, $tes
|
||||
ctools_include('context');
|
||||
ctools_include('context-task-handler');
|
||||
|
||||
// Add my contexts
|
||||
// Add my contexts.
|
||||
$contexts = ctools_context_handler_get_handler_contexts($base_contexts, $handler);
|
||||
|
||||
// Test.
|
||||
|
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
/**
|
||||
* Specialized implementation of hook_page_manager_task_tasks(). See api-task.html for
|
||||
* more information.
|
||||
@@ -10,7 +14,7 @@ function page_manager_blog_page_manager_tasks() {
|
||||
}
|
||||
|
||||
return array(
|
||||
// This is a 'page' task and will fall under the page admin UI
|
||||
// This is a 'page' task and will fall under the page admin UI.
|
||||
'task type' => 'page',
|
||||
|
||||
'title' => t('All blogs'),
|
||||
@@ -68,7 +72,7 @@ function page_manager_blog_menu_alter(&$items, $task) {
|
||||
* node edit, which is node_page_edit().
|
||||
*/
|
||||
function page_manager_blog() {
|
||||
// Load my task plugin
|
||||
// Load my task plugin.
|
||||
$task = page_manager_get_task('blog');
|
||||
|
||||
ctools_include('context');
|
||||
@@ -113,6 +117,7 @@ function page_manager_blog_enable($cache, $status) {
|
||||
* The subtask id
|
||||
* @param $contexts
|
||||
* The contexts loaded for the task.
|
||||
*
|
||||
* @return
|
||||
* TRUE if the current user can access the page.
|
||||
*/
|
||||
|
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
/**
|
||||
* Specialized implementation of hook_page_manager_task_tasks(). See api-task.html for
|
||||
* more information.
|
||||
@@ -10,7 +14,7 @@ function page_manager_blog_user_page_manager_tasks() {
|
||||
}
|
||||
|
||||
return array(
|
||||
// This is a 'page' task and will fall under the page admin UI
|
||||
// This is a 'page' task and will fall under the page admin UI.
|
||||
'task type' => 'page',
|
||||
'title' => t('User blog'),
|
||||
'admin title' => t('User blog'),
|
||||
@@ -53,7 +57,7 @@ function page_manager_blog_user_menu_alter(&$items, $task) {
|
||||
$items['blog/%user_uid_optional']['file'] = $task['file'];
|
||||
}
|
||||
else {
|
||||
// automatically disable this task if it cannot be enabled.
|
||||
// Automatically disable this task if it cannot be enabled.
|
||||
variable_set('page_manager_blog_user_disabled', TRUE);
|
||||
if (!empty($GLOBALS['page_manager_enabling_blog_user'])) {
|
||||
drupal_set_message(t('Page manager module is unable to enable blog/%user because some other module already has overridden with %callback.', array('%callback' => $items['blog/%user']['page callback'])), 'error');
|
||||
@@ -143,6 +147,7 @@ function page_manager_blog_user_enable($cache, $status) {
|
||||
* The subtask id
|
||||
* @param $contexts
|
||||
* The contexts loaded for the task.
|
||||
*
|
||||
* @return
|
||||
* TRUE if the current user can access the page.
|
||||
*/
|
||||
|
@@ -1,4 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
/**
|
||||
* Specialized implementation of hook_page_manager_task_tasks(). See api-task.html for
|
||||
* more information.
|
||||
@@ -9,7 +14,7 @@ function page_manager_comment_reply_page_manager_tasks() {
|
||||
}
|
||||
|
||||
return array(
|
||||
// This is a 'page' task and will fall under the page admin UI
|
||||
// This is a 'page' task and will fall under the page admin UI.
|
||||
'task type' => 'page',
|
||||
|
||||
'title' => t('Comment Reply page'),
|
||||
@@ -45,13 +50,11 @@ function page_manager_comment_reply_enable($cache, $status) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Entry point for our overridden comment.
|
||||
*
|
||||
*/
|
||||
function page_manager_comment_reply_page($node, $pid = NULL){
|
||||
// Load my task plugin
|
||||
function page_manager_comment_reply_page($node, $pid = NULL) {
|
||||
// Load my task plugin.
|
||||
$task = page_manager_get_task('comment_reply');
|
||||
|
||||
// Load the node into a context.
|
||||
@@ -134,7 +137,7 @@ function page_manager_comment_reply_menu_alter(&$items, $task) {
|
||||
$items['comment/reply/%node']['file'] = $task['file'];
|
||||
}
|
||||
else {
|
||||
// automatically disable this task if it cannot be enabled.
|
||||
// Automatically disable this task if it cannot be enabled.
|
||||
variable_set('page_manager_comment_reply_disabled', TRUE);
|
||||
if (!empty($GLOBALS['page_manager_enabling_comment_reply'])) {
|
||||
drupal_set_message(t('Page manager module is unable to enable comment/reply/%node because some other module already has overridden with %callback.', array('%callback' => $callback)), 'error');
|
||||
@@ -153,6 +156,7 @@ function page_manager_comment_reply_menu_alter(&$items, $task) {
|
||||
* The subtask id
|
||||
* @param $contexts
|
||||
* The contexts loaded for the task.
|
||||
*
|
||||
* @return
|
||||
* TRUE if the current user can access the page.
|
||||
*/
|
||||
|
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
/**
|
||||
* Specialized implementation of hook_page_manager_task_tasks(). See api-task.html for
|
||||
* more information.
|
||||
@@ -10,7 +14,7 @@ function page_manager_contact_site_page_manager_tasks() {
|
||||
}
|
||||
|
||||
return array(
|
||||
// This is a 'page' task and will fall under the page admin UI
|
||||
// This is a 'page' task and will fall under the page admin UI.
|
||||
'task type' => 'page',
|
||||
|
||||
'title' => t('Site contact page'),
|
||||
@@ -72,7 +76,7 @@ function page_manager_contact_site_menu_alter(&$items, $task) {
|
||||
* node edit, which is node_page_edit().
|
||||
*/
|
||||
function page_manager_contact_site() {
|
||||
// Load my task plugin
|
||||
// Load my task plugin.
|
||||
$task = page_manager_get_task('contact_site');
|
||||
|
||||
ctools_include('context');
|
||||
@@ -121,6 +125,7 @@ function page_manager_contact_site_enable($cache, $status) {
|
||||
* The subtask id
|
||||
* @param $contexts
|
||||
* The contexts loaded for the task.
|
||||
*
|
||||
* @return
|
||||
* TRUE if the current user can access the page.
|
||||
*/
|
||||
|
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
/**
|
||||
* Specialized implementation of hook_page_manager_task_tasks(). See api-task.html for
|
||||
* more information.
|
||||
@@ -9,7 +13,7 @@ function page_manager_contact_user_page_manager_tasks() {
|
||||
return;
|
||||
}
|
||||
return array(
|
||||
// This is a 'page' task and will fall under the page admin UI
|
||||
// This is a 'page' task and will fall under the page admin UI.
|
||||
'task type' => 'page',
|
||||
'title' => t('User contact'),
|
||||
'admin title' => t('User contact'),
|
||||
@@ -56,7 +60,7 @@ function page_manager_contact_user_menu_alter(&$items, $task) {
|
||||
$items['user/%user/contact']['file'] = $task['file'];
|
||||
}
|
||||
else {
|
||||
// automatically disable this task if it cannot be enabled.
|
||||
// Automatically disable this task if it cannot be enabled.
|
||||
variable_set('page_manager_contact_user_disabled', TRUE);
|
||||
if (!empty($GLOBALS['page_manager_enabling_contact_user'])) {
|
||||
drupal_set_message(t('Page manager module is unable to enable user/%user/contact because some other module already has overridden with %callback.', array('%callback' => $callback)), 'error');
|
||||
@@ -146,6 +150,7 @@ function page_manager_contact_user_enable($cache, $status) {
|
||||
* The subtask id
|
||||
* @param $contexts
|
||||
* The contexts loaded for the task.
|
||||
*
|
||||
* @return
|
||||
* TRUE if the current user can access the page.
|
||||
*/
|
||||
|
@@ -1,12 +1,16 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
/**
|
||||
* Specialized implementation of hook_page_manager_task_tasks(). See api-task.html for
|
||||
* more information.
|
||||
*/
|
||||
function page_manager_node_edit_page_manager_tasks() {
|
||||
return array(
|
||||
// This is a 'page' task and will fall under the page admin UI
|
||||
// This is a 'page' task and will fall under the page admin UI.
|
||||
'task type' => 'page',
|
||||
|
||||
'title' => t('Node add/edit form'),
|
||||
@@ -83,7 +87,7 @@ function page_manager_node_edit_menu_alter(&$items, $task) {
|
||||
* node edit, which is node_page_edit().
|
||||
*/
|
||||
function page_manager_node_edit($node) {
|
||||
// Load my task plugin
|
||||
// Load my task plugin.
|
||||
$task = page_manager_get_task('node_edit');
|
||||
|
||||
// Load the node into a context.
|
||||
@@ -176,6 +180,7 @@ function page_manager_node_edit_enable($cache, $status) {
|
||||
* The subtask id
|
||||
* @param $contexts
|
||||
* The contexts loaded for the task.
|
||||
*
|
||||
* @return
|
||||
* TRUE if the current user can access the page.
|
||||
*/
|
||||
|
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
function page_manager_node_view_page_manager_tasks() {
|
||||
return array(
|
||||
// This is a 'page' task and will fall under the page admin UI
|
||||
// This is a 'page' task and will fall under the page admin UI.
|
||||
'task type' => 'page',
|
||||
|
||||
'title' => t('Node template'),
|
||||
@@ -60,7 +60,7 @@ function page_manager_node_view_menu_alter(&$items, $task) {
|
||||
$items['node/%node']['file'] = $task['file'];
|
||||
}
|
||||
else {
|
||||
// automatically disable this task if it cannot be enabled.
|
||||
// Automatically disable this task if it cannot be enabled.
|
||||
variable_set('page_manager_node_view_disabled', TRUE);
|
||||
if (!empty($GLOBALS['page_manager_enabling_node_view'])) {
|
||||
drupal_set_message(t('Page manager module is unable to enable node/%node because some other module already has overridden with %callback.', array('%callback' => $callback)), 'error');
|
||||
@@ -78,13 +78,30 @@ function page_manager_node_view_menu_alter(&$items, $task) {
|
||||
* node view, which is node_page_view().
|
||||
*/
|
||||
function page_manager_node_view_page($node) {
|
||||
// Load my task plugin
|
||||
// Load my task plugin.
|
||||
$task = page_manager_get_task('node_view');
|
||||
|
||||
// Load the node into a context.
|
||||
ctools_include('context');
|
||||
ctools_include('context-task-handler');
|
||||
|
||||
$uri = entity_uri('node', $node);
|
||||
if (isset($uri['path'])) {
|
||||
// Set the node path as the canonical URL to prevent duplicate content.
|
||||
$meta_canon = array(
|
||||
'rel' => 'canonical',
|
||||
'href' => url($uri['path'], $uri['options']),
|
||||
);
|
||||
drupal_add_html_head_link($meta_canon, TRUE);
|
||||
|
||||
// Set the non-aliased path as a default shortlink.
|
||||
$meta_short = array(
|
||||
'rel' => 'shortlink',
|
||||
'href' => url($uri['path'], array_merge($uri['options'], array('alias' => TRUE))),
|
||||
);
|
||||
drupal_add_html_head_link($meta_short, TRUE);
|
||||
}
|
||||
|
||||
// Load all contexts.
|
||||
$contexts = ctools_context_handler_get_task_contexts($task, '', array($node));
|
||||
|
||||
@@ -157,6 +174,7 @@ function page_manager_node_view_enable($cache, $status) {
|
||||
* The subtask id
|
||||
* @param $contexts
|
||||
* The contexts loaded for the task.
|
||||
*
|
||||
* @return
|
||||
* TRUE if the current user can access the page.
|
||||
*/
|
||||
|
@@ -47,7 +47,7 @@ function page_manager_page_menu(&$items, $task) {
|
||||
'type' => MENU_CALLBACK,
|
||||
) + $base;
|
||||
|
||||
// Add menu entries for each subtask
|
||||
// Add menu entries for each subtask.
|
||||
foreach (page_manager_page_load_all() as $subtask_id => $subtask) {
|
||||
if (!empty($subtask->disabled)) {
|
||||
continue;
|
||||
@@ -102,12 +102,12 @@ function page_manager_page_menu(&$items, $task) {
|
||||
$page_arguments[] = $position;
|
||||
$access_arguments[] = $position;
|
||||
}
|
||||
else if ($bit[0] != '!') {
|
||||
elseif ($bit[0] != '!') {
|
||||
$path[] = $bit;
|
||||
}
|
||||
|
||||
// Increment position. We do it like this to skip empty items that
|
||||
// could happen from erroneous paths like: this///that
|
||||
// could happen from erroneous paths like: this///that.
|
||||
$position++;
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ function page_manager_page_menu_item($task, $menu, $access_arguments, $page_argu
|
||||
|
||||
case 'normal':
|
||||
$item['type'] = MENU_NORMAL_ITEM;
|
||||
// Insert item into the proper menu
|
||||
// Insert item into the proper menu.
|
||||
$item['menu_name'] = $menu['name'];
|
||||
break;
|
||||
|
||||
@@ -261,10 +261,10 @@ function page_manager_page_add_subtask($task_name = NULL, $step = NULL) {
|
||||
if (isset($form_info['add order'][$id])) {
|
||||
$form_info['order'][$id] = $form_info['add order'][$id];
|
||||
}
|
||||
else if (isset($handler_plugin['add features'][$id])) {
|
||||
elseif (isset($handler_plugin['add features'][$id])) {
|
||||
$form_info['order'][$id] = $handler_plugin['add features'][$id];
|
||||
}
|
||||
else if (isset($handler_plugin['required forms'][$id])) {
|
||||
elseif (isset($handler_plugin['required forms'][$id])) {
|
||||
$form_info['order'][$id] = $handler_plugin['required forms'][$id];
|
||||
}
|
||||
}
|
||||
@@ -279,7 +279,7 @@ function page_manager_page_add_subtask($task_name = NULL, $step = NULL) {
|
||||
// our questions determined would be next.
|
||||
if ($step == 'next') {
|
||||
$keys = array_keys($form_info['order']);
|
||||
// get rid of 'basic' from the list of forms.
|
||||
// Get rid of 'basic' from the list of forms.
|
||||
array_shift($keys);
|
||||
$step = array_shift($keys);
|
||||
|
||||
@@ -416,7 +416,7 @@ function page_manager_page_form_basic($form, &$form_state) {
|
||||
'#default_value' => $page->admin_description,
|
||||
);
|
||||
|
||||
// path
|
||||
// Path.
|
||||
$form['path'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Path'),
|
||||
@@ -452,7 +452,7 @@ function page_manager_page_form_basic($form, &$form_state) {
|
||||
'#description' => t('Admin overlays are used in many places in Drupal 7 and administrative custom pages should probably utilize this feature.'),
|
||||
);
|
||||
}
|
||||
else if ($path == $frontpage) {
|
||||
elseif ($path == $frontpage) {
|
||||
$form['frontpage_markup'] = array(
|
||||
'#value' => '<b>' . t('This page is currently set to be your site home page. This can be modified on the !siteinfo configuration form.', array('!siteinfo' => l(t('Site Information'), 'admin/settings/site-information'))) . '</b>',
|
||||
);
|
||||
@@ -516,7 +516,7 @@ function page_manager_page_form_basic_validate(&$form, &$form_state) {
|
||||
$path = array();
|
||||
if (empty($form_state['values']['path'])) {
|
||||
form_error($form['path'], t('Path is required.'));
|
||||
// stop processing here if there is no path.
|
||||
// Stop processing here if there is no path.
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -542,7 +542,7 @@ function page_manager_page_form_basic_validate(&$form, &$form_state) {
|
||||
|
||||
$path[] = '%';
|
||||
}
|
||||
else if ($bit[0] == '!') {
|
||||
elseif ($bit[0] == '!') {
|
||||
$found = TRUE;
|
||||
}
|
||||
else {
|
||||
@@ -620,9 +620,10 @@ function page_manager_page_form_basic_submit(&$form, &$form_state) {
|
||||
$title = !empty($form_state['values']['title']) ? $form_state['values']['title'] : $plugin['title'];
|
||||
page_manager_handler_add_to_page($cache, $handler, $title);
|
||||
|
||||
// Figure out which forms to present them with
|
||||
// Figure out which forms to present them with.
|
||||
$cache->forms = array();
|
||||
$cache->forms[] = 'basic'; // This one is always there.
|
||||
// This one is always there.
|
||||
$cache->forms[] = 'basic';
|
||||
if (!empty($form_state['arguments'])) {
|
||||
$cache->forms[] = 'argument';
|
||||
}
|
||||
@@ -787,7 +788,6 @@ function page_manager_page_form_menu($form, &$form_state) {
|
||||
function page_manager_page_form_menu_validate(&$form, &$form_state) {
|
||||
// If setting a 'normal' menu entry, make sure that any placeholders
|
||||
// support the to_arg stuff.
|
||||
|
||||
if ($form_state['values']['menu']['type'] == 'normal') {
|
||||
$page = $form_state['page']->subtask['subtask'];
|
||||
|
||||
@@ -876,7 +876,7 @@ function page_manager_page_form_argument($form, &$form_state) {
|
||||
if (isset($page->temporary_arguments[$keyword]) && !empty($form_state['allow temp'])) {
|
||||
$conf = $page->temporary_arguments[$keyword];
|
||||
}
|
||||
else if (isset($page->arguments[$keyword])) {
|
||||
elseif (isset($page->arguments[$keyword])) {
|
||||
$conf = $page->arguments[$keyword];
|
||||
}
|
||||
|
||||
@@ -896,7 +896,7 @@ function page_manager_page_form_argument($form, &$form_state) {
|
||||
$form['table']['argument'][$keyword]['#position'] = $position;
|
||||
$form['table']['argument'][$keyword]['#context'] = $context;
|
||||
|
||||
// The URL for this ajax button
|
||||
// The URL for this ajax button.
|
||||
$form['table']['argument'][$keyword]['change-url'] = array(
|
||||
'#attributes' => array('class' => array("page-manager-context-$keyword-change-url")),
|
||||
'#type' => 'hidden',
|
||||
@@ -913,7 +913,7 @@ function page_manager_page_form_argument($form, &$form_state) {
|
||||
|
||||
// Only show the button if this has a settings form available:
|
||||
if (!empty($plugin)) {
|
||||
// The URL for this ajax button
|
||||
// The URL for this ajax button.
|
||||
$form['table']['argument'][$keyword]['settings-url'] = array(
|
||||
'#attributes' => array('class' => array("page-manager-context-$keyword-settings-url")),
|
||||
'#type' => 'hidden',
|
||||
@@ -970,7 +970,7 @@ function theme_page_manager_page_form_argument_table($vars) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajax entry point to edit an item
|
||||
* Ajax entry point to edit an item.
|
||||
*/
|
||||
function page_manager_page_subtask_argument_ajax($step = NULL, $task_name = NULL, $keyword = NULL) {
|
||||
ctools_include('ajax');
|
||||
@@ -995,7 +995,7 @@ function page_manager_page_subtask_argument_ajax($step = NULL, $task_name = NULL
|
||||
return ctools_ajax_render_error(t('Invalid keyword.'));
|
||||
}
|
||||
|
||||
// Set up wizard info
|
||||
// Set up wizard info.
|
||||
$form_info = array(
|
||||
'id' => 'page_manager_page_argument',
|
||||
'path' => "admin/structure/pages/argument/%step/$task_name/$keyword",
|
||||
@@ -1032,7 +1032,7 @@ function page_manager_page_subtask_argument_ajax($step = NULL, $task_name = NULL
|
||||
if (!empty($form_state['cancel'])) {
|
||||
$commands = array(ctools_modal_command_dismiss());
|
||||
}
|
||||
else if (!empty($form_state['complete'])) {
|
||||
elseif (!empty($form_state['complete'])) {
|
||||
if (isset($page->temporary_arguments[$keyword])) {
|
||||
$page->arguments[$keyword] = $page->temporary_arguments[$keyword];
|
||||
}
|
||||
@@ -1051,7 +1051,6 @@ function page_manager_page_subtask_argument_ajax($step = NULL, $task_name = NULL
|
||||
// fully processed, but is guaranteed to produce the same form we
|
||||
// started with so we don't have to do crazy stuff to rerender
|
||||
// just part of it.
|
||||
|
||||
// @todo should there be a tool to do this?
|
||||
|
||||
$clone_state = $form_state;
|
||||
@@ -1174,7 +1173,7 @@ function page_manager_page_argument_form_change_submit(&$form, &$form_state) {
|
||||
if (is_array($plugin['default'])) {
|
||||
$settings = $plugin['default'];
|
||||
}
|
||||
else if (function_exists($plugin['default'])) {
|
||||
elseif (function_exists($plugin['default'])) {
|
||||
$settings = $plugin['default']();
|
||||
}
|
||||
}
|
||||
@@ -1201,7 +1200,7 @@ function page_manager_page_argument_form_settings($form, &$form_state) {
|
||||
if (isset($page->temporary_arguments[$keyword])) {
|
||||
$conf = $page->temporary_arguments[$keyword];
|
||||
}
|
||||
else if (isset($page->arguments[$keyword])) {
|
||||
elseif (isset($page->arguments[$keyword])) {
|
||||
$conf = $page->temporary_arguments[$keyword] = $page->arguments[$keyword];
|
||||
}
|
||||
|
||||
@@ -1271,7 +1270,7 @@ function page_manager_page_argument_form_settings_submit(&$form, &$form_state) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Import a task handler from cut & paste
|
||||
* Import a task handler from cut & paste.
|
||||
*/
|
||||
function page_manager_page_import_subtask($form, &$form_state, $task_name) {
|
||||
$form_state['task'] = page_manager_get_task($task_name);
|
||||
@@ -1414,7 +1413,7 @@ function page_manager_page_form_clone($form, &$form_state) {
|
||||
'#description' => t('Enter the name to the new page It must be unique and contain only alphanumeric characters and underscores.'),
|
||||
);
|
||||
|
||||
// path
|
||||
// Path.
|
||||
$form['path'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Path'),
|
||||
@@ -1449,7 +1448,7 @@ function page_manager_page_form_clone_validate(&$form, &$form_state) {
|
||||
}
|
||||
|
||||
/**
|
||||
* submit clone page form.
|
||||
* Submit clone page form.
|
||||
*
|
||||
* Load the page, change the name(s) to protect the innocent, and if
|
||||
* requested, load all the task handlers so that they get saved properly too.
|
||||
|
@@ -32,7 +32,7 @@ function page_manager_page_page_manager_tasks() {
|
||||
'function' => 'page_manager_page_menu',
|
||||
),
|
||||
'hook theme' => 'page_manager_page_theme',
|
||||
// page only items
|
||||
// Page only items.
|
||||
'task type' => 'page',
|
||||
'page operations' => array(
|
||||
array(
|
||||
@@ -49,7 +49,7 @@ function page_manager_page_page_manager_tasks() {
|
||||
),
|
||||
'page type' => 'custom',
|
||||
|
||||
// context only items
|
||||
// Context only items.
|
||||
'handler type' => 'context',
|
||||
'get arguments' => array(
|
||||
'file' => 'page.admin.inc',
|
||||
@@ -112,7 +112,7 @@ function page_manager_page_save_subtask($subtask) {
|
||||
}
|
||||
}
|
||||
page_manager_page_recalculate_arguments($page);
|
||||
// Create a real object from the cache
|
||||
// Create a real object from the cache.
|
||||
page_manager_page_save($page);
|
||||
|
||||
// Check to see if we should make this the site frontpage.
|
||||
@@ -191,7 +191,7 @@ function page_manager_page_build_subtask($task, $page) {
|
||||
'form' => 'page_manager_page_form_delete',
|
||||
);
|
||||
}
|
||||
else if ($page->export_type != EXPORT_IN_CODE) {
|
||||
elseif ($page->export_type != EXPORT_IN_CODE) {
|
||||
$operations['actions']['children']['delete'] = array(
|
||||
'title' => t('Delete'),
|
||||
'description' => t('Remove this page from your system completely.'),
|
||||
@@ -216,11 +216,11 @@ function page_manager_page_build_subtask($task, $page) {
|
||||
'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
|
||||
// This works for both enable AND disable.
|
||||
'enable callback' => 'page_manager_page_enable',
|
||||
);
|
||||
|
||||
// default handlers may appear from a default subtask.
|
||||
// Default handlers may appear from a default subtask.
|
||||
if (isset($page->default_handlers)) {
|
||||
$subtask['default handlers'] = $page->default_handlers;
|
||||
}
|
||||
@@ -247,8 +247,7 @@ function page_manager_page_theme(&$items, $task) {
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Page execution functions
|
||||
|
||||
// Page execution functions.
|
||||
/**
|
||||
* Execute a page task.
|
||||
*
|
||||
@@ -262,6 +261,7 @@ function page_manager_page_theme(&$items, $task) {
|
||||
* creating named arguments in the path.
|
||||
*/
|
||||
function page_manager_page_execute($subtask_id) {
|
||||
$func_args = func_get_args();
|
||||
$page = page_manager_page_load($subtask_id);
|
||||
$task = page_manager_get_task($page->task);
|
||||
$subtask = page_manager_get_task_subtask($task, $subtask_id);
|
||||
@@ -269,12 +269,12 @@ function page_manager_page_execute($subtask_id) {
|
||||
// Turn the contexts into a properly keyed array.
|
||||
$contexts = array();
|
||||
$args = array();
|
||||
foreach (func_get_args() as $count => $arg) {
|
||||
foreach ($func_args as $count => $arg) {
|
||||
if (is_object($arg) && get_class($arg) == 'ctools_context') {
|
||||
$contexts[$arg->id] = $arg;
|
||||
$args[] = $arg->original_argument;
|
||||
}
|
||||
else if ($count) {
|
||||
elseif ($count) {
|
||||
$args[] = $arg;
|
||||
}
|
||||
}
|
||||
@@ -302,9 +302,9 @@ function page_manager_page_execute($subtask_id) {
|
||||
$context = ctools_context_get_context_from_argument($argument, $value);
|
||||
}
|
||||
else {
|
||||
// make sure there is a placeholder context for missing optional contexts.
|
||||
// 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
|
||||
// Force the title to blank for replacements.
|
||||
}
|
||||
if ($context) {
|
||||
$contexts[$context->id] = $context;
|
||||
@@ -328,8 +328,7 @@ function page_manager_page_execute($subtask_id) {
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Context type callbacks
|
||||
|
||||
// Context type callbacks.
|
||||
/**
|
||||
* Return a list of arguments used by this task.
|
||||
*/
|
||||
@@ -432,7 +431,7 @@ function page_manager_page_save(&$page) {
|
||||
/**
|
||||
* Remove a page subtask.
|
||||
*/
|
||||
function page_manager_page_delete($page) {
|
||||
function page_manager_page_delete($page, $skip_menu_rebuild = FALSE) {
|
||||
$task = page_manager_get_task($page->task);
|
||||
if ($function = ctools_plugin_get_function($task, 'delete')) {
|
||||
$function($page);
|
||||
@@ -450,7 +449,11 @@ function page_manager_page_delete($page) {
|
||||
// rebuild this page again.
|
||||
ctools_include('export');
|
||||
ctools_export_load_object_reset('page_manager_pages');
|
||||
menu_rebuild();
|
||||
// Allow menu rebuild to be skipped when calling code is deleting multiple
|
||||
// pages.
|
||||
if (!$skip_menu_rebuild) {
|
||||
menu_rebuild();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -500,7 +503,7 @@ function page_manager_page_get_named_arguments($path) {
|
||||
$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 %
|
||||
// Special handling for duplicate path items and substr to remove the %.
|
||||
$arguments[substr($bit, 1)] = isset($arguments[$bit]) ? -1 : $position;
|
||||
}
|
||||
}
|
||||
@@ -547,7 +550,7 @@ function _pm_arg_load($value, $subtask, $argument) {
|
||||
ctools_include('context');
|
||||
$context = ctools_context_get_context_from_argument($page->arguments[$keyword], $value);
|
||||
|
||||
// convert false equivalents to false.
|
||||
// Convert false equivalents to false.
|
||||
return $context ? $context : FALSE;
|
||||
}
|
||||
|
||||
@@ -583,7 +586,6 @@ function page_manager_page_admin_summary($task, $subtask) {
|
||||
array('class' => array('page-summary-operation'), 'data' => $link),
|
||||
);
|
||||
|
||||
|
||||
$path = array();
|
||||
foreach (explode('/', $page->path) as $bit) {
|
||||
if ($bit[0] != '!') {
|
||||
@@ -599,7 +601,7 @@ function page_manager_page_admin_summary($task, $subtask) {
|
||||
if ($path == $front) {
|
||||
$message = t('This is your site home page.');
|
||||
}
|
||||
else if (!empty($page->make_frontpage)) {
|
||||
elseif (!empty($page->make_frontpage)) {
|
||||
$message = t('This page is set to become your site home page.');
|
||||
}
|
||||
|
||||
@@ -660,6 +662,7 @@ function page_manager_page_admin_summary($task, $subtask) {
|
||||
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();
|
||||
@@ -750,7 +753,7 @@ function page_manager_page_new_page_cache(&$page, &$cache) {
|
||||
$cache->subtask = page_manager_page_build_subtask($cache->task, $page);
|
||||
|
||||
if (isset($cache->handlers)) {
|
||||
foreach($cache->handlers as $id => $handler) {
|
||||
foreach ($cache->handlers as $id => $handler) {
|
||||
$cache->handler_info[$id]['changed'] = PAGE_MANAGER_CHANGED_DELETED;
|
||||
}
|
||||
}
|
||||
@@ -778,6 +781,7 @@ function page_manager_page_new_page_cache(&$page, &$cache) {
|
||||
* The subtask id
|
||||
* @param $contexts
|
||||
* The contexts loaded for the task.
|
||||
*
|
||||
* @return
|
||||
* TRUE if the current user can access the page.
|
||||
*/
|
||||
|
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
/**
|
||||
* Specialized implementation of hook_page_manager_task_tasks(). See api-task.html for
|
||||
* more information.
|
||||
@@ -10,7 +14,7 @@ function page_manager_poll_page_manager_tasks() {
|
||||
}
|
||||
|
||||
return array(
|
||||
// This is a 'page' task and will fall under the page admin UI
|
||||
// This is a 'page' task and will fall under the page admin UI.
|
||||
'task type' => 'page',
|
||||
|
||||
'title' => t('All polls'),
|
||||
@@ -68,7 +72,7 @@ function page_manager_poll_menu_alter(&$items, $task) {
|
||||
* node edit, which is node_page_edit().
|
||||
*/
|
||||
function page_manager_poll() {
|
||||
// Load my task plugin
|
||||
// Load my task plugin.
|
||||
$task = page_manager_get_task('poll');
|
||||
|
||||
ctools_include('context');
|
||||
@@ -113,6 +117,7 @@ function page_manager_poll_enable($cache, $status) {
|
||||
* The subtask id
|
||||
* @param $contexts
|
||||
* The contexts loaded for the task.
|
||||
*
|
||||
* @return
|
||||
* TRUE if the current user can access the page.
|
||||
*/
|
||||
|
@@ -10,8 +10,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Specialized implementation of hook_page_manager_task_tasks(). See api-task.html for
|
||||
* more information.
|
||||
* Specialized implementation of hook_page_manager_task_tasks().
|
||||
*
|
||||
* See api-task.html for more information.
|
||||
*/
|
||||
function page_manager_search_page_manager_tasks() {
|
||||
if (!module_exists('search')) {
|
||||
@@ -19,7 +20,7 @@ function page_manager_search_page_manager_tasks() {
|
||||
}
|
||||
|
||||
return array(
|
||||
// This is a 'page' task and will fall under the page admin UI
|
||||
// This is a 'page' task and will fall under the page admin UI.
|
||||
'task type' => 'page',
|
||||
'title' => t('Search'),
|
||||
|
||||
@@ -38,7 +39,6 @@ function page_manager_search_page_manager_tasks() {
|
||||
'get arguments' => 'page_manager_search_get_arguments',
|
||||
'get context placeholders' => 'page_manager_search_get_contexts',
|
||||
'access callback' => 'page_manager_search_access_check',
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
@@ -59,7 +59,6 @@ function page_manager_search_menu_alter(&$items, $task) {
|
||||
// keywords. A second set is for searching *with* keywords. This
|
||||
// is necessary because search/node/% and search/node need to be
|
||||
// different due to the way the search menu items function.
|
||||
|
||||
$default_info = search_get_default_module_info();
|
||||
if (empty($default_info)) {
|
||||
// Nothing to do.
|
||||
@@ -85,7 +84,7 @@ function page_manager_search_menu_alter(&$items, $task) {
|
||||
$items["$path/%menu_tail"]['file'] = $task['file'];
|
||||
}
|
||||
else {
|
||||
// automatically disable this task if it cannot be enabled.
|
||||
// Automatically disable this task if it cannot be enabled.
|
||||
variable_set('page_manager_search_disabled_' . $module, TRUE);
|
||||
if (!empty($GLOBALS['page_manager_enabling_search'])) {
|
||||
drupal_set_message(t('Page manager module is unable to enable @path because some other module already has overridden with %callback.', array('%callback' => $callback, '@path' => $path)), 'error');
|
||||
@@ -96,12 +95,9 @@ function page_manager_search_menu_alter(&$items, $task) {
|
||||
|
||||
/**
|
||||
* Entry point for our overridden search page.
|
||||
*
|
||||
*/
|
||||
function page_manager_search_page($type) {
|
||||
ctools_include('menu');
|
||||
// menu_set_active_trail(ctools_get_menu_trail('search/' . $type));
|
||||
|
||||
// Get the arguments and construct a keys string out of them.
|
||||
$args = func_get_args();
|
||||
|
||||
@@ -111,10 +107,10 @@ function page_manager_search_page($type) {
|
||||
// And implode() it all back together.
|
||||
$keys = $args ? implode('/', $args) : '';
|
||||
|
||||
// Allow other modules to alter the search keys
|
||||
drupal_alter(array('search_keys', 'search_'. $type .'_keys'), $keys);
|
||||
// Allow other modules to alter the search keys.
|
||||
drupal_alter(array('search_keys', 'search_' . $type . '_keys'), $keys);
|
||||
|
||||
// Load my task plugin
|
||||
// Load my task plugin.
|
||||
$task = page_manager_get_task('search');
|
||||
$subtask = page_manager_get_task_subtask($task, $type);
|
||||
|
||||
@@ -138,7 +134,6 @@ function page_manager_search_page($type) {
|
||||
}
|
||||
|
||||
// Otherwise, fall back.
|
||||
|
||||
// Put the $type back on the arguments.
|
||||
module_load_include('inc', 'search', 'search.pages');
|
||||
array_unshift($args, $type);
|
||||
@@ -224,7 +219,7 @@ function page_manager_search_build_subtask($task, $module) {
|
||||
'row class' => empty($page->disabled) ? 'page-manager-enabled' : 'page-manager-disabled',
|
||||
'storage' => t('In code'),
|
||||
'disabled' => variable_get('page_manager_search_disabled_' . $module, TRUE),
|
||||
// This works for both enable AND disable
|
||||
// This works for both enable AND disable.
|
||||
'enable callback' => 'page_manager_search_enable',
|
||||
);
|
||||
|
||||
@@ -240,6 +235,7 @@ function page_manager_search_build_subtask($task, $module) {
|
||||
* The subtask id
|
||||
* @param $contexts
|
||||
* The contexts loaded for the task.
|
||||
*
|
||||
* @return
|
||||
* TRUE if the current user can access the page.
|
||||
*/
|
||||
|
@@ -16,7 +16,7 @@
|
||||
function page_manager_term_view_page_manager_tasks() {
|
||||
if (module_exists('taxonomy')) {
|
||||
return array(
|
||||
// This is a 'page' task and will fall under the page admin UI
|
||||
// This is a 'page' task and will fall under the page admin UI.
|
||||
'task type' => 'page',
|
||||
|
||||
'title' => t('Taxonomy term template'),
|
||||
@@ -29,7 +29,7 @@ function page_manager_term_view_page_manager_tasks() {
|
||||
'hook menu' => 'page_manager_term_view_menu',
|
||||
'hook menu alter' => 'page_manager_term_view_menu_alter',
|
||||
|
||||
// Provide a setting to the primary settings UI for Panels
|
||||
// Provide a setting to the primary settings UI for Panels.
|
||||
'admin settings' => 'page_manager_term_view_admin_settings',
|
||||
// Even though we don't have subtasks, this allows us to save our settings.
|
||||
'save subtask callback' => 'page_manager_term_view_save',
|
||||
@@ -48,7 +48,7 @@ function page_manager_term_view_page_manager_tasks() {
|
||||
'enable callback' => 'page_manager_term_view_enable',
|
||||
'access callback' => 'page_manager_term_view_access_check',
|
||||
|
||||
// Allow additional operations
|
||||
// Allow additional operations.
|
||||
'operations' => array(
|
||||
'settings' => array(
|
||||
'title' => t('Settings'),
|
||||
@@ -79,7 +79,7 @@ function page_manager_term_view_menu_alter(&$items, $task) {
|
||||
$items['taxonomy/term/%taxonomy_term']['file'] = $task['file'];
|
||||
}
|
||||
else {
|
||||
// automatically disable this task if it cannot be enabled.
|
||||
// Automatically disable this task if it cannot be enabled.
|
||||
variable_set('page_manager_term_view_disabled', TRUE);
|
||||
|
||||
if (isset($items['taxonomy/term/%taxonomy_term']['page callback'])) {
|
||||
@@ -87,7 +87,7 @@ function page_manager_term_view_menu_alter(&$items, $task) {
|
||||
}
|
||||
// Because Views changes %taxonomy_term to %views_arg, check to see if that
|
||||
// is why we can't enable:
|
||||
else if (isset($items['taxonomy/term/%views_arg']['page callback'])) {
|
||||
elseif (isset($items['taxonomy/term/%views_arg']['page callback'])) {
|
||||
$callback = $items['taxonomy/term/%views_arg']['page callback'];
|
||||
}
|
||||
else {
|
||||
@@ -112,7 +112,6 @@ function page_manager_term_view_page($term, $depth = NULL) {
|
||||
// potentially load nodes that were not necessary, execute some of the code
|
||||
// prior to identifying the correct CTools or Page Manager task handler and
|
||||
// only proceed with the rest of the code if necessary.
|
||||
|
||||
// Assign the term name as the page title.
|
||||
drupal_set_title($term->name);
|
||||
|
||||
@@ -126,10 +125,10 @@ function page_manager_term_view_page($term, $depth = NULL) {
|
||||
// Set the non-aliased path as a default shortlink.
|
||||
drupal_add_html_head_link(array('rel' => 'shortlink', 'href' => url($uri['path'], array_merge($uri['options'], array('alias' => TRUE)))), TRUE);
|
||||
|
||||
// Trigger the main
|
||||
// Trigger the main.
|
||||
$build = taxonomy_term_show($term);
|
||||
|
||||
// Load my task plugin
|
||||
// Load my task plugin.
|
||||
$task = page_manager_get_task('term_view');
|
||||
|
||||
// Load the term into a context.
|
||||
@@ -157,7 +156,6 @@ function page_manager_term_view_page($term, $depth = NULL) {
|
||||
|
||||
// Otherwise, fall back to replicating the output normally generated by
|
||||
// taxonomy_term_page().
|
||||
|
||||
// Build breadcrumb based on the hierarchy of the term.
|
||||
$current = (object) array(
|
||||
'tid' => $term->tid,
|
||||
@@ -296,7 +294,6 @@ function page_manager_term_view_enable($cache, $status) {
|
||||
}
|
||||
|
||||
function page_manager_term_view_get_type() {
|
||||
// $view_type = variable_get('page_manager_term_view_type', 'multiple');
|
||||
// Revert to just allowing single.
|
||||
$view_type = 'single';
|
||||
|
||||
@@ -369,7 +366,8 @@ function page_manager_term_view_admin_summary($task, $subtask) {
|
||||
* The subtask id
|
||||
* @param $contexts
|
||||
* The contexts loaded for the task.
|
||||
* @return
|
||||
*
|
||||
* @return bool
|
||||
* TRUE if the current user can access the page.
|
||||
*/
|
||||
function page_manager_term_view_access_check($task, $subtask_id, $contexts) {
|
||||
|
@@ -9,7 +9,7 @@
|
||||
*/
|
||||
function page_manager_user_edit_page_manager_tasks() {
|
||||
return array(
|
||||
// This is a 'page' task and will fall under the page admin UI
|
||||
// This is a 'page' task and will fall under the page admin UI.
|
||||
'task type' => 'page',
|
||||
'title' => t('User Edit Template'),
|
||||
'admin title' => t('User edit template'),
|
||||
@@ -65,7 +65,7 @@ function page_manager_user_edit_menu_alter(&$items, $task) {
|
||||
}
|
||||
}
|
||||
else {
|
||||
// automatically disable this task if it cannot be enabled.
|
||||
// Automatically disable this task if it cannot be enabled.
|
||||
variable_set('page_manager_user_edit_disabled', TRUE);
|
||||
if (!empty($GLOBALS['page_manager_enabling_user_edit'])) {
|
||||
drupal_set_message(t('Page manager module is unable to enable user/%user/edit because some other module already has overridden with %callback.', array('%callback' => $items['user/%user']['page callback'])), 'error');
|
||||
@@ -114,9 +114,9 @@ function page_manager_user_edit_page($account, $category = 'account') {
|
||||
// Otherwise, fall back.
|
||||
if ($function == 'drupal_get_form') {
|
||||
|
||||
//In order to ajax fields to work we need to run form_load_include.
|
||||
//Hence we eschew drupal_get_form and manually build the info and
|
||||
//call drupal_build_form.
|
||||
// In order to ajax fields to work we need to run form_load_include.
|
||||
// Hence we eschew drupal_get_form and manually build the info and
|
||||
// call drupal_build_form.
|
||||
$form_state = array();
|
||||
$form_id = 'user_profile_form';
|
||||
$args = array($account, $category);
|
||||
@@ -125,10 +125,9 @@ function page_manager_user_edit_page($account, $category = 'account') {
|
||||
$output = drupal_build_form($form_id, $form_state);
|
||||
return $output;
|
||||
}
|
||||
//fire off "view" op so that triggers still work
|
||||
// Fire off "view" op so that triggers still work.
|
||||
// @todo -- this doesn't work anymore, and the alternatives seem bad.
|
||||
// will have to figure out how to fix this.
|
||||
// user_module_invoke('view', $array = array(), $account);
|
||||
return $function($account);
|
||||
}
|
||||
|
||||
@@ -178,6 +177,7 @@ function page_manager_user_edit_enable($cache, $status) {
|
||||
* The subtask id
|
||||
* @param $contexts
|
||||
* The contexts loaded for the task.
|
||||
*
|
||||
* @return
|
||||
* TRUE if the current user can access the page.
|
||||
*/
|
||||
|
@@ -9,7 +9,7 @@
|
||||
*/
|
||||
function page_manager_user_view_page_manager_tasks() {
|
||||
return array(
|
||||
// This is a 'page' task and will fall under the page admin UI
|
||||
// This is a 'page' task and will fall under the page admin UI.
|
||||
'task type' => 'page',
|
||||
'title' => t('User profile template'),
|
||||
'admin title' => t('User profile template'),
|
||||
@@ -53,7 +53,7 @@ function page_manager_user_view_menu_alter(&$items, $task) {
|
||||
$items['user/%user']['file'] = $task['file'];
|
||||
}
|
||||
else {
|
||||
// automatically disable this task if it cannot be enabled.
|
||||
// Automatically disable this task if it cannot be enabled.
|
||||
variable_set('page_manager_user_view_disabled', TRUE);
|
||||
if (!empty($GLOBALS['page_manager_enabling_user_view'])) {
|
||||
drupal_set_message(t('Page manager module is unable to enable user/%user because some other module already has overridden with %callback.', array('%callback' => $items['user/%user']['page callback'])), 'error');
|
||||
@@ -98,10 +98,9 @@ function page_manager_user_view_page($account) {
|
||||
if ($function == 'user_view') {
|
||||
module_load_include('inc', 'user', 'user.pages');
|
||||
}
|
||||
//fire off "view" op so that triggers still work
|
||||
// Fire off "view" op so that triggers still work.
|
||||
// @todo -- this doesn't work anymore, and the alternatives seem bad.
|
||||
// will have to figure out how to fix this.
|
||||
// user_module_invoke('view', $array = array(), $account);
|
||||
return $function($account);
|
||||
}
|
||||
|
||||
@@ -152,6 +151,7 @@ function page_manager_user_view_enable($cache, $status) {
|
||||
* The subtask id
|
||||
* @param $contexts
|
||||
* The contexts loaded for the task.
|
||||
*
|
||||
* @return
|
||||
* TRUE if the current user can access the page.
|
||||
*/
|
||||
|
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Tests the head links for page manager pages.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Test the head links.
|
||||
*/
|
||||
class HeadLinksTestCase extends DrupalWebTestCase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function getInfo() {
|
||||
return array(
|
||||
'name' => 'Head links test',
|
||||
'description' => 'Checks that the shortlink and canonical links are present on a node page overriden by Page manager',
|
||||
'group' => 'ctools',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setUp() {
|
||||
parent::setUp('page_manager');
|
||||
|
||||
// First add an override for "node/%node".
|
||||
variable_set('page_manager_node_view_disabled', FALSE);
|
||||
|
||||
$record = (object) array(
|
||||
'name' => 'node_view__http_response_707659df-062d-4252-8c2a-22a8e0289cd4',
|
||||
'task' => 'node_view',
|
||||
'subtask' => '',
|
||||
'handler' => 'http_response',
|
||||
'weight' => '1',
|
||||
'conf' => array(
|
||||
'title' => 'Test',
|
||||
'contexts' => array(
|
||||
0 => array(
|
||||
'identifier' => 'String',
|
||||
'keyword' => 'string',
|
||||
'name' => 'string',
|
||||
'string' => 'Test',
|
||||
'id' => 1,
|
||||
),
|
||||
),
|
||||
'relationships' => array(),
|
||||
'code' => '404',
|
||||
'destination' => '',
|
||||
'name' => '',
|
||||
),
|
||||
);
|
||||
|
||||
page_manager_save_task_handler($record);
|
||||
|
||||
menu_rebuild();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the presence of the head links.
|
||||
*/
|
||||
public function testHeadLinks() {
|
||||
$node = $this->drupalCreateNode();
|
||||
$url = 'node/' . $node->nid;
|
||||
$this->drupalGet($url);
|
||||
|
||||
$shortlink = $this->xpath('//head//link[@rel="shortlink"]');
|
||||
$this->assertEqual(url($url), (string) $shortlink[0]['href'], 'shortlink url found');
|
||||
|
||||
$canonical = $this->xpath('//head//link[@rel="canonical"]');
|
||||
$this->assertEqual(url($url), (string) $canonical[0]['href'], 'canonical url found');
|
||||
}
|
||||
|
||||
}
|
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Template for the page manager page editor.
|
||||
@@ -42,7 +43,7 @@
|
||||
<div class="description">
|
||||
<?php print $content['description']; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<?php print $content['content']; ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -50,4 +51,4 @@
|
||||
</div>
|
||||
</div>
|
||||
<?php print $save; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -27,10 +27,10 @@ function template_preprocess_page_manager_edit_page(&$vars) {
|
||||
$vars['locked'] = theme('page_manager_lock', array('page' => $page));
|
||||
$vars['changed'] = theme('page_manager_changed', array('text' => t('Locked'), 'description' => t('This page is being edited by another user and you cannot make changes to it.')));
|
||||
}
|
||||
else if (!empty($page->new)) {
|
||||
elseif (!empty($page->new)) {
|
||||
$vars['changed'] = theme('page_manager_changed', array('text' => t('New'), 'description' => t('This page is newly created and has not yet been saved to the database. It will not be available until you save it.')));
|
||||
}
|
||||
else if (!empty($page->changed)) {
|
||||
elseif (!empty($page->changed)) {
|
||||
$vars['changed'] = theme('page_manager_changed', array('text' => t('Changed'), 'description' => t('This page has been modified, but these modifications are not yet live. While modifying this page, it is locked from modification by other users.')));
|
||||
}
|
||||
|
||||
@@ -49,9 +49,9 @@ function template_preprocess_page_manager_edit_page(&$vars) {
|
||||
*/
|
||||
function theme_page_manager_handler_rearrange($vars) {
|
||||
$form = &$vars['form'];
|
||||
// Assemble the data for a table from everything in $form['handlers']
|
||||
// Assemble the data for a table from everything in $form['handlers'].
|
||||
foreach (element_children($form['handlers']) as $id) {
|
||||
// provide a reference shortcut.
|
||||
// Provide a reference shortcut.
|
||||
$element = &$form['handlers'][$id];
|
||||
if (isset($element['title'])) {
|
||||
$row = array();
|
||||
|
Reference in New Issue
Block a user