You are here

function bg_image_is_excluded in Background Images 7

Checks if a path should be excluded from background images

Parameters

string $path: The path to check against exclusions. Will default to current path if not provided

Return value

boolean TRUE if the path should be excluded or FALSE

1 call to bg_image_is_excluded()
bg_image_add_background_image in ./bg_image.module
Adds a background image to the page using the css 'background' property.

File

./bg_image.module, line 548
Allows for customizable background images per page

Code

function bg_image_is_excluded($path = NULL) {

  // Get Current Path if not provided
  if (!$path) {
    $path = current_path();
  }

  // Set to <front> if necessary
  if ($path === '') {
    $path = '<front>';
  }

  // Create an array of paths
  $paths = array(
    $path,
  );

  // Add alias to paths array if exists
  if ($path != drupal_get_path_alias($path)) {
    $paths[] = drupal_get_path_alias($path);
  }

  // Check for admin paths first
  if (variable_get('bg_image_exclude_admin', 0) && path_is_admin($_GET['q'])) {
    return TRUE;
  }

  // Check custom exclusions
  if ($exclusions = variable_get('bg_image_exclude_paths', '')) {
    foreach ($paths as $path) {
      if (drupal_match_path($path, $exclusions)) {
        return TRUE;
      }
    }
  }
  return FALSE;
}