Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
In plugins/access/path_visibility.inc
:
/**
* Check for access.
*/
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;
}
If $context->data
is set, then a visibility rule of node/30
will never match $base_path = 'node/30'
, only node/30
's alias (if it has one)...
if (!isset($context->data) && $path != $base_path) {
... sigh.
In other words, the plugin only works with internal Drupal paths IF they don't have an alias drupal_get_path_alias()
OR when $context->data
is not set in the function ctools_path_visibility_ctools_access_check
.
Comments
Comment #2
dolphinonmobile CreditAttribution: dolphinonmobile as a volunteer commentedComment #3
dolphinonmobile CreditAttribution: dolphinonmobile as a volunteer commented