function hook_preprocess

cis7 theme.api.php hook_preprocess(&$variables, $hook)
cle7 theme.api.php hook_preprocess(&$variables, $hook)
elmsmedia7 theme.api.php hook_preprocess(&$variables, $hook)
icor7 theme.api.php hook_preprocess(&$variables, $hook)
meedjum_blog7 theme.api.php hook_preprocess(&$variables, $hook)
mooc7 theme.api.php hook_preprocess(&$variables, $hook)

Preprocess theme variables for templates.

This hook allows modules to preprocess theme variables for theme templates. It is called for all theme hooks implemented as templates, but not for theme hooks implemented as functions. hook_preprocess_HOOK() can be used to preprocess variables for a specific theme hook, whether implemented as a template or function.

For more detailed information, see theme().

Parameters

$variables: The variables array (modify in place).

$hook: The name of the theme hook.

7 functions implement hook_preprocess()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

adaptivetheme_preprocess in sites/all/themes/ulmus/adaptivetheme/at_core/inc/preprocess.inc
Preprocess variables for all templates.
alpha_preprocess in sites/all/themes/ulmus/omega/alpha/template.php
Implements hook_preprocess().
contextual_preprocess in modules/contextual/contextual.module
Implements hook_preprocess().
field_attach_preprocess in modules/field/field.attach.inc
Populate the template variables with the field values available for rendering.
search_invoke_preprocess in modules/search/search.module
Invokes hook_search_preprocess() in modules.

... See full list

File

modules/system/theme.api.php, line 113

Code

function hook_preprocess(&$variables, $hook) {
  static $hooks;

  // Add contextual links to the variables, if the user has permission.

  if (!user_access('access contextual links')) {
    return;
  }

  if (!isset($hooks)) {
    $hooks = theme_get_registry();
  }

  // Determine the primary theme function argument.
  if (isset($hooks[$hook]['variables'])) {
    $keys = array_keys($hooks[$hook]['variables']);
    $key = $keys[0];
  }
  else {
    $key = $hooks[$hook]['render element'];
  }

  if (isset($variables[$key])) {
    $element = $variables[$key];
  }

  if (isset($element) && is_array($element) && !empty($element['#contextual_links'])) {
    $variables['title_suffix']['contextual_links'] = contextual_links_view($element);
    if (!empty($variables['title_suffix']['contextual_links'])) {
      $variables['classes_array'][] = 'contextual-links-region';
    }
  }
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.