function viewport_path_is_selected in Viewport 7
Checks whether a given path (or the current path if none is provided) has been configured to display a viewport tag.
Parameters
string $path: The path or alias of a page to be checked against the selected pages for the viewport.
Return value
bool TRUE if the patch is present in the selected values, FALSE otherwise.
1 call to viewport_path_is_selected()
- viewport_preprocess_html in ./
viewport.module - Implements hook_preprocess_html().
File
- ./
viewport.module, line 122 - viewport module Allows to set a viewport metatag with custom settings for a selected set of pages.
Code
function viewport_path_is_selected($path = NULL) {
// Use the variable of $_GET['q'] as the default $path.
if (is_null($path)) {
$path = current_path();
}
$viewport_pages = variable_get('viewport_selected_pages', '');
// Normalise the pages selected and the path looked for.
$path_alias = drupal_strtolower(drupal_get_path_alias($path));
$path = strtolower($path);
$viewport_pages = strtolower($viewport_pages);
// Page will match if current patch matches, or its alias (if any) matches.
$page_match = drupal_match_path($path, $viewport_pages);
if ($path_alias != $path && !$page_match) {
$page_match = drupal_match_path($path_alias, $viewport_pages);
}
return $page_match;
}