8.5.x theme.inc _template_preprocess_default_variables()
8.0.x theme.inc _template_preprocess_default_variables()
8.1.x theme.inc _template_preprocess_default_variables()
8.2.x theme.inc _template_preprocess_default_variables()
8.3.x theme.inc _template_preprocess_default_variables()
8.4.x theme.inc _template_preprocess_default_variables()
8.6.x theme.inc _template_preprocess_default_variables()
7.x theme.inc _template_preprocess_default_variables()

Returns hook-independent variables to template_preprocess().

1 call to _template_preprocess_default_variables()
template_preprocess in includes/theme.inc
Adds a default set of helper variables for variable processors and templates.

File

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

Code

function _template_preprocess_default_variables() {
  global $user;

  // Variables that don't depend on a database connection.
  $variables = array(
    'attributes_array' => array(),
    'title_attributes_array' => array(),
    'content_attributes_array' => array(),
    'title_prefix' => array(),
    'title_suffix' => array(),
    'user' => $user,
    'db_is_active' => !defined('MAINTENANCE_MODE'),
    'is_admin' => FALSE,
    'logged_in' => FALSE,
  );

  // The user object has no uid property when the database does not exist during
  // install. The user_access() check deals with issues when in maintenance mode
  // as uid is set but the user.module has not been included.
  if (isset($user->uid) && function_exists('user_access')) {
    $variables['is_admin'] = user_access('access administration pages');
    $variables['logged_in'] = $user->uid > 0;
  }

  // drupal_is_front_page() might throw an exception.
  try {
    $variables['is_front'] = drupal_is_front_page();
  } catch (Exception $e) {

    // If the database is not yet available, set default values for these
    // variables.
    $variables['is_front'] = FALSE;
    $variables['db_is_active'] = FALSE;
  }
  return $variables;
}