Skip to content
Snippets Groups Projects
Commit 017e3d14 authored by Steven Wittens's avatar Steven Wittens
Browse files

- #27794: Alphabetize phptemplate variables

parent c81bbf4a
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -92,16 +92,17 @@ function _phptemplate_default_variables($hook, $variables) { ...@@ -92,16 +92,17 @@ function _phptemplate_default_variables($hook, $variables) {
function phptemplate_features() { function phptemplate_features() {
return array( return array(
'logo', 'logo',
'toggle_favicon', 'toggle_comment_user_picture',
'toggle_name', 'toggle_favicon',
'toggle_search', 'toggle_mission',
'toggle_slogan', 'toggle_name',
'toggle_mission', 'toggle_node_user_picture',
'toggle_primary_links', 'toggle_primary_links',
'toggle_secondary_links', 'toggle_search',
'toggle_node_user_picture', 'toggle_secondary_links',
'toggle_comment_user_picture'); 'toggle_slogan'
);
} }
/** /**
...@@ -154,33 +155,32 @@ function phptemplate_page($content) { ...@@ -154,33 +155,32 @@ function phptemplate_page($content) {
} }
$variables = array( $variables = array(
'breadcrumb' => theme('breadcrumb', drupal_get_breadcrumb()),
'closure' => theme('closure'),
'content' => '<!-- begin content -->' . $content . '<!-- end content -->',
'footer_message' => variable_get('site_footer', FALSE),
'head' => drupal_get_html_head(),
'head_title' => implode(' | ', $head_title), 'head_title' => implode(' | ', $head_title),
'help' => theme('help'),
'language' => $GLOBALS['locale'], 'language' => $GLOBALS['locale'],
'site' => variable_get('site_name', 'drupal'), 'layout' => $layout,
'head' => drupal_get_html_head(),
'onload_attributes' => theme('onload_attribute'),
'logo' => theme_get_setting('logo'), 'logo' => theme_get_setting('logo'),
'messages' => theme('status_messages'),
'mission' => $mission,
'onload_attributes' => theme('onload_attribute'),
'primary_links' => theme_get_setting('primary_links'),
'site_name' => (theme_get_setting('toggle_name') ? variable_get('site_name', 'Drupal') : ''), 'site_name' => (theme_get_setting('toggle_name') ? variable_get('site_name', 'Drupal') : ''),
'site_slogan' => (theme_get_setting('toggle_slogan') ? variable_get('site_slogan', '') : ''), 'site_slogan' => (theme_get_setting('toggle_slogan') ? variable_get('site_slogan', '') : ''),
'search_box' => theme_get_setting('toggle_search'), 'search_box' => theme_get_setting('toggle_search'),
'search_url' => url('search'),
'search_button_text' => t('search'), 'search_button_text' => t('search'),
'search_description' => t('Enter the terms you wish to search for.'), 'search_description' => t('Enter the terms you wish to search for.'),
'title' => drupal_get_title(), 'search_url' => url('search'),
'primary_links' => theme_get_setting('primary_links'),
'secondary_links' => theme_get_setting('secondary_links'), 'secondary_links' => theme_get_setting('secondary_links'),
'breadcrumb' => theme('breadcrumb', drupal_get_breadcrumb()),
'tabs' => theme('menu_local_tasks'),
'messages' => theme('status_messages'),
'layout' => $layout,
'help' => theme('help'),
'styles' => theme_get_styles(),
'mission' => $mission,
'sidebar_left' => $sidebar_left, 'sidebar_left' => $sidebar_left,
'content' => '<!-- begin content -->' . $content . '<!-- end content -->',
'sidebar_right' => $sidebar_right, 'sidebar_right' => $sidebar_right,
'footer_message' => variable_get('site_footer', FALSE), 'styles' => theme_get_styles(),
'closure' => theme('closure') 'tabs' => theme('menu_local_tasks'),
'title' => drupal_get_title()
); );
if ((arg(0) == 'node') && is_int(arg(1))) { if ((arg(0) == 'node') && is_int(arg(1))) {
$variables['node'] = node_load(arg(1)); $variables['node'] = node_load(arg(1));
...@@ -202,18 +202,18 @@ function phptemplate_node($node, $main = 0, $page = 0) { ...@@ -202,18 +202,18 @@ function phptemplate_node($node, $main = 0, $page = 0) {
} }
$variables = array( $variables = array(
'title' => check_plain($node->title), 'content' => ($main && $node->teaser) ? $node->teaser : $node->body,
'node_url' => url('node/'. $node->nid), 'date' => format_date($node->created),
'terms' => theme('links', $taxonomy), 'links' => $node->links ? theme('links', $node->links) : '',
'name' => format_name($node), 'main' => $main,
'date' => format_date($node->created), 'name' => format_name($node),
'content' => ($main && $node->teaser) ? $node->teaser : $node->body, 'node' => $node, // we pass the actual node to allow more customization
'links' => $node->links ? theme('links', $node->links) : '', 'node_url' => url('node/'. $node->nid),
'taxonomy' => $taxonomy, 'page' => $page,
'main' => $main, 'taxonomy' => $taxonomy,
'page' => $page, 'terms' => theme('links', $taxonomy),
'node' => $node // we pass the actual node to allow more customization 'title' => check_plain($node->title)
); );
// Flatten the node object's member fields. // Flatten the node object's member fields.
$variables = array_merge(object2array($node), $variables); $variables = array_merge(object2array($node), $variables);
...@@ -233,18 +233,17 @@ function phptemplate_node($node, $main = 0, $page = 0) { ...@@ -233,18 +233,17 @@ function phptemplate_node($node, $main = 0, $page = 0) {
*/ */
function phptemplate_comment($comment, $links = 0) { function phptemplate_comment($comment, $links = 0) {
return _phptemplate_callback('comment', array( return _phptemplate_callback('comment', array(
'new' => $comment->new ? t('new') : '', 'author' => format_name($comment),
'comment' => $comment, 'comment' => $comment,
'submitted' => t('Submitted by %a on %b.',
array('%a' => format_name($comment), array('%a' => format_name($comment),
'%b' => format_date($comment->timestamp))), '%b' => format_date($comment->timestamp))),
'title' => l($comment->subject, $_GET['q'], NULL, NULL, "comment-$comment->cid"),
'picture' => theme_get_setting('toggle_comment_user_picture') ? theme('user_picture', $comment) : '',
'links' => $links,
'content' => $comment->comment, 'content' => $comment->comment,
'author' => format_name($comment), 'date' => format_date($comment->timestamp),
'date' => format_date($comment->timestamp) 'links' => $links,
'new' => $comment->new ? t('new') : '',
'picture' => theme_get_setting('toggle_comment_user_picture') ? theme('user_picture', $comment) : '',
'submitted' => t('Submitted by %a on %b.',
'title' => l($comment->subject, $_GET['q'], NULL, NULL, "comment-$comment->cid")
)); ));
} }
...@@ -262,9 +261,9 @@ function phptemplate_block($block) { ...@@ -262,9 +261,9 @@ function phptemplate_block($block) {
*/ */
function phptemplate_box($title, $content, $region = 'main') { function phptemplate_box($title, $content, $region = 'main') {
return _phptemplate_callback('box', array( return _phptemplate_callback('box', array(
'title' => $title,
'content' => $content, 'content' => $content,
'region' => $region 'region' => $region,
'title' => $title
)); ));
} }
...@@ -304,7 +303,7 @@ function _phptemplate_default($hook, $variables, $file = null) { ...@@ -304,7 +303,7 @@ function _phptemplate_default($hook, $variables, $file = null) {
} }
if ($file) { if ($file) {
extract($variables); // Extract the vars to local namespace extract($variables); // Extract the vars to local namespace
ob_start(); // Start output buffering ob_start(); // Start output buffering
include($file); // Include the file include($file); // Include the file
$contents = ob_get_contents(); // Get the contents of the buffer $contents = ob_get_contents(); // Get the contents of the buffer
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment