function alpha_alter

cis7 alpha.inc alpha_alter($type, &$data, &$context1 = NULL, &$context2 = NULL)
cle7 alpha.inc alpha_alter($type, &$data, &$context1 = NULL, &$context2 = NULL)
elmsmedia7 alpha.inc alpha_alter($type, &$data, &$context1 = NULL, &$context2 = NULL)
icor7 alpha.inc alpha_alter($type, &$data, &$context1 = NULL, &$context2 = NULL)
meedjum_blog7 alpha.inc alpha_alter($type, &$data, &$context1 = NULL, &$context2 = NULL)
mooc7 alpha.inc alpha_alter($type, &$data, &$context1 = NULL, &$context2 = NULL)

This function "fixes" drupal_alter so it also works in the theme-settings and anywhere else where you want to be 100% certain that drupal_alter uses the proper global $theme.

The problem with drupal_alter is, that it always relies on the global $theme while the theme-settings page relies (and "overrides") the global $theme_key variable while building its form.

Parameters

$type:

$data:

$context1:

$context2:

See also

See drupal_alter() for more information about how this works.

9 calls to alpha_alter()
alpha_page_alter in sites/all/themes/ulmus/omega/alpha/template.php
Implements hook_page_alter().
alpha_retrieve_css in sites/all/themes/ulmus/omega/alpha/includes/alpha.inc
Retrieves an array of available custom CSS files for a theme.
alpha_retrieve_grids in sites/all/themes/ulmus/omega/alpha/includes/alpha.inc
Retrieves an array of available grids for a theme.
alpha_retrieve_libraries in sites/all/themes/ulmus/omega/alpha/includes/alpha.inc
Retrieves an array of available libraries for a theme.
alpha_theme_container::cacheable in sites/all/themes/ulmus/omega/alpha/includes/base.inc
@todo

... See full list

File

sites/all/themes/ulmus/omega/alpha/includes/alpha.inc, line 132
Helper functions for the Alpha base theme.

Code

function alpha_alter($type, &$data, &$context1 = NULL, &$context2 = NULL) {
  global $theme, $base_theme_info;

  if ($theme != $context1) {
    $themes = list_themes();

    if (!empty($themes[$context1])) {
      $theme_original = $theme;
      $base_theme_info_original = $base_theme_info;

      foreach (alpha_theme_trail($context1) as $key => $title) {
        if (isset($themes[$key])) {
          $base_theme_info[$key] = $themes[$key];
        }
      }

      $functions = &drupal_static('drupal_alter');

      if (!empty($base_theme_info)) {
        foreach ($base_theme_info as $item) {
          if (is_file(drupal_get_path('theme', $item->name) . '/template.php')) {
            include_once drupal_get_path('theme', $item->name) . '/template.php';
          }
        }
      }

      array_pop($base_theme_info);

      $theme = $context1;

      drupal_alter($type, $data, $context1, $context2);

      $theme = $theme_original;
      $base_theme_info = $base_theme_info_original;

      unset($functions[$type]);
    }
  }
  else {
    drupal_alter($type, $data, $context1, $context2);
  }
}
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.