Commit c094757a authored by catch's avatar catch

Issue #1963942 by joelpittet, ACF, dasjo: Change all instances of $vars to $variables.

parent 2d922c31
......@@ -141,9 +141,9 @@ public function __construct(array $options = array()) {
* @todo Remove this function once $GLOBALS['language'] is gone.
*/
public function extend($obj) {
$vars = get_object_vars($obj);
foreach ($vars as $var => $value) {
$this->$var = $value;
$variables = get_object_vars($obj);
foreach ($variables as $variable => $value) {
$this->$variable = $value;
}
}
......
......@@ -89,13 +89,13 @@ function color_css_alter(&$css) {
*
* Replace the logo with the colored version if available.
*/
function color_preprocess_page(&$vars) {
function color_preprocess_page(&$variables) {
global $theme_key;
// Override logo.
$logo = config('color.' . $theme_key)->get('logo');
if ($logo && $vars['logo'] && preg_match('!' . $theme_key . '/logo.png$!', $vars['logo'])) {
$vars['logo'] = file_create_url($logo);
if ($logo && $variables['logo'] && preg_match('!' . $theme_key . '/logo.png$!', $variables['logo'])) {
$variables['logo'] = file_create_url($logo);
}
}
......
......@@ -622,21 +622,21 @@ function node_views_data() {
/**
* Implements hook_preprocess_node().
*/
function node_row_node_view_preprocess_node(&$vars) {
$node = $vars['node'];
$options = $vars['view']->rowPlugin->options;
function node_row_node_view_preprocess_node(&$variables) {
$node = $variables['node'];
$options = $variables['view']->rowPlugin->options;
// Prevent the comment form from showing up if this is not a page display.
if ($vars['view_mode'] == 'full' && !$vars['view']->display_handler->hasPath()) {
if ($variables['view_mode'] == 'full' && !$variables['view']->display_handler->hasPath()) {
$node->comment = FALSE;
}
if (!$options['links']) {
unset($vars['content']['links']);
unset($variables['content']['links']);
}
if (!empty($options['comments']) && user_access('access comments') && $node->comment) {
$vars['content']['comments'] = comment_node_page_additions($node);
$variables['content']['comments'] = comment_node_page_additions($node);
}
}
......
......@@ -236,26 +236,26 @@ function views_plugin_list() {
* we haven't got a chance to load that file before Drupal builds the
* node portion of the theme registry.
*/
function views_preprocess_node(&$vars) {
function views_preprocess_node(&$variables) {
Drupal::moduleHandler()->loadInclude('node', 'views.inc');
// The 'view' attribute of the node is added in views_preprocess_node()
if (!empty($vars['node']->view) && $vars['node']->view->storage->id()) {
$vars['view'] = $vars['node']->view;
$vars['theme_hook_suggestions'][] = 'node__view__' . $vars['node']->view->storage->id();
if (!empty($vars['node']->view->current_display)) {
$vars['theme_hook_suggestions'][] = 'node__view__' . $vars['node']->view->storage->id() . '__' . $vars['node']->view->current_display;
if (!empty($variables['node']->view) && $variables['node']->view->storage->id()) {
$variables['view'] = $variables['node']->view;
$variables['theme_hook_suggestions'][] = 'node__view__' . $variables['node']->view->storage->id();
if (!empty($variables['node']->view->current_display)) {
$variables['theme_hook_suggestions'][] = 'node__view__' . $variables['node']->view->storage->id() . '__' . $variables['node']->view->current_display;
// If a node is being rendered in a view, and the view does not have a path,
// prevent drupal from accidentally setting the $page variable:
if ($vars['page'] && $vars['view_mode'] == 'full' && !$vars['view']->display_handler->hasPath()) {
$vars['page'] = FALSE;
if ($variables['page'] && $variables['view_mode'] == 'full' && !$variables['view']->display_handler->hasPath()) {
$variables['page'] = FALSE;
}
}
}
// Allow to alter comments and links based on the settings in the row plugin.
if (!empty($vars['view']->rowPlugin) && $vars['view']->rowPlugin->getPluginId() == 'entity:node') {
node_row_node_view_preprocess_node($vars);
if (!empty($variables['view']->rowPlugin) && $variables['view']->rowPlugin->getPluginId() == 'entity:node') {
node_row_node_view_preprocess_node($variables);
}
}
......@@ -263,13 +263,13 @@ function views_preprocess_node(&$vars) {
* A theme preprocess function to automatically allow view-based node
* templates if called from a view.
*/
function views_preprocess_comment(&$vars) {
function views_preprocess_comment(&$variables) {
// The 'view' attribute of the node is added in template_preprocess_views_view_row_comment()
if (!empty($vars['comment']->view) && $vars['comment']->view->storage->id()) {
$vars['view'] = &$vars['comment']->view;
$vars['theme_hook_suggestions'][] = 'comment__view__' . $vars['comment']->view->storage->id();
if (!empty($vars['node']->view->current_display)) {
$vars['theme_hook_suggestions'][] = 'comment__view__' . $vars['comment']->view->storage->id() . '__' . $vars['comment']->view->current_display;
if (!empty($variables['comment']->view) && $variables['comment']->view->storage->id()) {
$variables['view'] = &$variables['comment']->view;
$variables['theme_hook_suggestions'][] = 'comment__view__' . $variables['comment']->view->storage->id();
if (!empty($variables['node']->view->current_display)) {
$variables['theme_hook_suggestions'][] = 'comment__view__' . $variables['comment']->view->storage->id() . '__' . $variables['comment']->view->current_display;
}
}
}
......
This diff is collapsed.
......@@ -212,21 +212,21 @@ function views_ui_library_info() {
/**
* Implements hook_preprocess_HOOK() for views-view.html.twig.
*/
function views_ui_preprocess_views_view(&$vars) {
$view = $vars['view'];
function views_ui_preprocess_views_view(&$variables) {
$view = $variables['view'];
if (!empty($view->live_preview) && Drupal::moduleHandler()->moduleExists('contextual')) {
$view->setShowAdminLinks(FALSE);
foreach (array('title', 'header', 'exposed', 'rows', 'pager', 'more', 'footer', 'empty', 'attachment_after', 'attachment_before') as $section) {
if (!empty($vars[$section])) {
$vars[$section] = array(
if (!empty($variables[$section])) {
$variables[$section] = array(
'#theme' => 'views_ui_view_preview_section',
'#view' => $view,
'#section' => $section,
'#content' => $vars[$section],
'#content' => $variables[$section],
'#theme_wrappers' => array('views_ui_container'),
'#attributes' => array('class' => 'contextual-region'),
);
$vars[$section] = $vars[$section];
$variables[$section] = $variables[$section];
}
}
}
......
......@@ -227,8 +227,8 @@ function theme_views_ui_build_group_filter_form($variables) {
/**
* Turn the rearrange form into a proper table
*/
function theme_views_ui_rearrange_filter_form(&$vars) {
$form = $vars['form'];
function theme_views_ui_rearrange_filter_form(&$variables) {
$form = $variables['form'];
$rows = $ungroupable_rows = array();
// Enable grouping only if > 1 group.
$grouping = count(array_keys($form['#group_options'])) > 1;
......@@ -428,49 +428,49 @@ function theme_views_ui_style_plugin_table($variables) {
* - view: The view object.
* - section: The section name of a View (e.g. title, rows or pager).
*/
function template_preprocess_views_ui_view_preview_section(&$vars) {
switch ($vars['section']) {
function template_preprocess_views_ui_view_preview_section(&$variables) {
switch ($variables['section']) {
case 'title':
$vars['title'] = t('Title');
$links = views_ui_view_preview_section_display_category_links($vars['view'], 'title', $vars['title']);
$variables['title'] = t('Title');
$links = views_ui_view_preview_section_display_category_links($variables['view'], 'title', $variables['title']);
break;
case 'header':
$vars['title'] = t('Header');
$links = views_ui_view_preview_section_handler_links($vars['view'], $vars['section']);
$variables['title'] = t('Header');
$links = views_ui_view_preview_section_handler_links($variables['view'], $variables['section']);
break;
case 'empty':
$vars['title'] = t('No results behavior');
$links = views_ui_view_preview_section_handler_links($vars['view'], $vars['section']);
$variables['title'] = t('No results behavior');
$links = views_ui_view_preview_section_handler_links($variables['view'], $variables['section']);
break;
case 'exposed':
// @todo Sorts can be exposed too, so we may need a better title.
$vars['title'] = t('Exposed Filters');
$links = views_ui_view_preview_section_display_category_links($vars['view'], 'exposed_form_options', $vars['title']);
$variables['title'] = t('Exposed Filters');
$links = views_ui_view_preview_section_display_category_links($variables['view'], 'exposed_form_options', $variables['title']);
break;
case 'rows':
// @todo The title needs to depend on what is being viewed.
$vars['title'] = t('Content');
$links = views_ui_view_preview_section_rows_links($vars['view']);
$variables['title'] = t('Content');
$links = views_ui_view_preview_section_rows_links($variables['view']);
break;
case 'pager':
$vars['title'] = t('Pager');
$links = views_ui_view_preview_section_display_category_links($vars['view'], 'pager_options', $vars['title']);
$variables['title'] = t('Pager');
$links = views_ui_view_preview_section_display_category_links($variables['view'], 'pager_options', $variables['title']);
break;
case 'more':
$vars['title'] = t('More');
$links = views_ui_view_preview_section_display_category_links($vars['view'], 'use_more', $vars['title']);
$variables['title'] = t('More');
$links = views_ui_view_preview_section_display_category_links($variables['view'], 'use_more', $variables['title']);
break;
case 'footer':
$vars['title'] = t('Footer');
$links = views_ui_view_preview_section_handler_links($vars['view'], $vars['section']);
$variables['title'] = t('Footer');
$links = views_ui_view_preview_section_handler_links($variables['view'], $variables['section']);
break;
case 'attachment_before':
// @todo: Add links to the attachment configuration page.
$vars['title'] = t('Attachment before');
$variables['title'] = t('Attachment before');
break;
case 'attachment_after':
// @todo: Add links to the attachment configuration page.
$vars['title'] = t('Attachment after');
$variables['title'] = t('Attachment after');
break;
}
......@@ -483,7 +483,7 @@ function template_preprocess_views_ui_view_preview_section(&$vars) {
'library' => array(array('contextual', 'drupal.contextual-links')),
),
);
$vars['links'] = $build;
$variables['links'] = $build;
}
$vars['theme_hook_suggestions'][] = 'views_ui_view_preview_section__' . $vars['section'];
$variables['theme_hook_suggestions'][] = 'views_ui_view_preview_section__' . $variables['section'];
}
......@@ -8,31 +8,31 @@
/**
* Implements hook_preprocess_HOOK() for maintenance-page.html.twig.
*/
function seven_preprocess_maintenance_page(&$vars) {
function seven_preprocess_maintenance_page(&$variables) {
// While markup for normal pages is split into page.tpl.php and html.tpl.php,
// the markup for the maintenance page is all in the single
// maintenance-page.html.twig template. So, to have what's done in
// seven_preprocess_html() also happen on the maintenance page, it has to be
// called here.
seven_preprocess_html($vars);
seven_preprocess_html($variables);
}
/**
* Implements hook_preprocess_HOOK() for html.tpl.php.
*/
function seven_preprocess_html(&$vars) {
function seven_preprocess_html(&$variables) {
drupal_add_library('system', 'normalize');
}
/**
* Implements hook_preprocess_HOOK() for page.tpl.php.
*/
function seven_preprocess_page(&$vars) {
$vars['primary_local_tasks'] = $vars['tabs'];
unset($vars['primary_local_tasks']['#secondary']);
$vars['secondary_local_tasks'] = array(
function seven_preprocess_page(&$variables) {
$variables['primary_local_tasks'] = $variables['tabs'];
unset($variables['primary_local_tasks']['#secondary']);
$variables['secondary_local_tasks'] = array(
'#theme' => 'menu_local_tasks',
'#secondary' => isset($vars['tabs']['#secondary']) ? $vars['tabs']['#secondary'] : '',
'#secondary' => isset($variables['tabs']['#secondary']) ? $variables['tabs']['#secondary'] : '',
);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment