_template_preprocess_default_variables

_template_preprocess_default_variables()

Returns hook-independent variables to template_preprocess().

File

core/includes/theme.inc, line 1223
The theme system, which controls the output of Drupal.

Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function _template_preprocess_default_variables() {
  // Variables that don't depend on a database connection.
  $variables = array(
    'attributes' => array(),
    'title_attributes' => array(),
    'content_attributes' => array(),
    'title_prefix' => array(),
    'title_suffix' => array(),
    'db_is_active' => !defined('MAINTENANCE_MODE'),
    'is_admin' => FALSE,
    'logged_in' => FALSE,
  );
 
  // Give modules a chance to alter the default template variables.
  \Drupal::moduleHandler()->alter('template_preprocess_default_variables', $variables);
 
  // Tell all templates where they are located.
  $variables['directory'] = \Drupal::theme()->getActiveTheme()->getPath();
 
  return $variables;
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.