You are here

function add_to_head_match_page in Add To Head 7

Same name and namespace in other branches
  1. 8 add_to_head.module \add_to_head_match_page()

Determines if code should be displayed on a particular page.

Originally from block_list().

Parameters

boolean $visibility: TRUE if visible only on selected pages or FALSE if visible on all except listed.

array $paths: The list of pages to match.

Return value

boolean TRUE if the code should be displayed on the page; FALSE otherwise.

1 call to add_to_head_match_page()
add_to_head_process_html in ./add_to_head.module
Implements hook_process_html().

File

./add_to_head.module, line 144
Add To Head allows abritrary insertion of code into the head of the page based on path selection.

Code

function add_to_head_match_page($visibility, $paths) {

  // Get the current path.
  $path = drupal_get_path_alias($_GET['q']);

  // Compare with the internal and path alias (if any).
  $page_match = drupal_match_path($path, $paths);
  if ($path != $_GET['q']) {
    $page_match = $page_match || drupal_match_path($_GET['q'], $paths);
  }

  // When $visibility has a value of 0, the code is displayed on
  // all pages except those listed in $paths. When set to 1, it
  // is displayed only on those pages listed in $paths.
  return !($visibility xor $page_match);
}