0

While editing a block I want to use "Pages on which this PHP code returns TRUE (experts only)" at the same time support the URL's entered in "All pages except those listed" plus my own custom conditions.

Where can I get the standard code to match those URL using PHP code?

For example as in figure initially "All pages except those listed" is checked on but now I want to choose the Experts only(3rd one).

In this Experts only mode before adding my custom code I'd like to check for exclusion of those same URL's first then proceed.enter image description here

0

I made this stuff copying from Core's block.module:

//This block will not show pages when these pattern match
$pages = <<< EOT
adsense/*
node/add/*
adsense/*
contact
privacy
tags/*
terms
about
check-for-expired-job
taxonomy/term/*   
EOT;


$pages = drupal_strtolower($pages);
$path = drupal_strtolower(drupal_get_path_alias($_GET['q']));
$hide_block = drupal_match_path($path, $pages);
if ($path != $_GET['q']) {
    $hide_block = $hide_block || drupal_match_path($_GET['q'], $pages);
}
if($hide_block)
{
return false;
}

//Now do other processing stuff

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.