function hook_html_head_alter

×

Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
cis7 system.api.php hook_html_head_alter(&$head_elements)
cle7 system.api.php hook_html_head_alter(&$head_elements)
elmsmedia7 system.api.php hook_html_head_alter(&$head_elements)
icor7 system.api.php hook_html_head_alter(&$head_elements)
meedjum_blog7 system.api.php hook_html_head_alter(&$head_elements)
mooc7 system.api.php hook_html_head_alter(&$head_elements)

Alter XHTML HEAD tags before they are rendered by drupal_get_html_head().

Elements available to be altered are only those added using drupal_add_html_head_link() or drupal_add_html_head(). CSS and JS files are handled using drupal_add_css() and drupal_add_js(), so the head links for those files will not appear in the $head_elements array.

Parameters

$head_elements: An array of renderable elements. Generally the values of the #attributes array will be the most likely target for changes.

Related topics

6 functions implement hook_html_head_alter()

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

adaptivetheme_html_head_alter in sites/all/themes/ulmus/adaptivetheme/at_core/inc/alter.inc
hook_html_head_alter()
ember_html_head_alter in sites/all/themes/ulmus/ember/template.php
Implements hook_html_head_alter().
fontfolio_html_head_alter in sites/all/themes/ulmus/fontfolio/template.php
Implements template_html_head_alter();
skeletontheme_html_head_alter in sites/all/themes/ulmus/skeletontheme/template.php
Implements hook_html_head_alter(). This will overwrite the default meta character type tag with HTML5 version.
textbook_html_head_alter in sites/all/modules/elmsln_contrib/textbook/textbook.module
Implements hook_html_head_alter().

... See full list

1 invocation of hook_html_head_alter()
drupal_get_html_head in includes/common.inc
Retrieves output to be displayed in the HEAD tag of the HTML page.

File

modules/system/system.api.php, line 3819
Hooks provided by Drupal core and the System module.

Code

function hook_html_head_alter(&$head_elements) {
  foreach ($head_elements as $key => $element) {
    if (isset($element['#attributes']['rel']) && $element['#attributes']['rel'] == 'canonical') {
      // I want a custom canonical URL.
      $head_elements[$key]['#attributes']['href'] = mymodule_canonical_url();
    }
  }
}