function ctools_path_visibility_ctools_access_check

Check for access.

1 string reference to 'ctools_path_visibility_ctools_access_check'
path_visibility.inc in plugins/access/path_visibility.inc

File

plugins/access/path_visibility.inc, line 47

Code

function ctools_path_visibility_ctools_access_check($conf, $context) {
    if (isset($context->data)) {
        $base_path = $context->data;
    }
    else {
        $base_path = $_GET['q'];
    }
    $path = drupal_get_path_alias($base_path);
    $page_match = drupal_match_path($path, $conf['paths']);
    // If there's a path alias, we may still be at the un-aliased path
    // so check that as well.
    if (!isset($context->data) && $path != $base_path) {
        $page_match = $page_match || drupal_match_path($base_path, $conf['paths']);
    }
    // When $conf['visibility_setting'] has a value of 0, the block is displayed
    // on all pages except those listed in $block->pages. When set to 1, it
    // is displayed only on those pages listed in $block->pages.
    $page_match = !($conf['visibility_setting'] xor $page_match);
    return $page_match;
}