You are here

function template_process in Drupal 7

Adds helper variables derived from variables defined during preprocessing.

When preparing variables for a theme hook implementation, all 'preprocess' functions run first, then all 'process' functions (see theme() for details about the full sequence).

This function serializes array variables manipulated during the preprocessing phase into strings for convenient use by templates. As with template_preprocess(), this function does not get called for theme hooks implemented as functions.

See also

theme()

template_preprocess()

File

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

Code

function template_process(&$variables, $hook) {

  // Flatten out classes.
  $variables['classes'] = implode(' ', $variables['classes_array']);

  // Flatten out attributes, title_attributes, and content_attributes.
  // Because this function can be called very often, and often with empty
  // attributes, optimize performance by only calling drupal_attributes() if
  // necessary.
  $variables['attributes'] = $variables['attributes_array'] ? drupal_attributes($variables['attributes_array']) : '';
  $variables['title_attributes'] = $variables['title_attributes_array'] ? drupal_attributes($variables['title_attributes_array']) : '';
  $variables['content_attributes'] = $variables['content_attributes_array'] ? drupal_attributes($variables['content_attributes_array']) : '';
}