Created
June 23, 2017 19:34
-
-
Save chupzzz/bcbc38201e8bb1abb87b14d66ea72e3e to your computer and use it in GitHub Desktop.
Match (check) given path for pattern/mask (like in Drupal blocks system).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$path = current_path(); | |
$path_alias = drupal_lookup_path('alias', $path); | |
$patterns = '' . PHP_EOL . 'node/n' . PHP_EOL . 'blog/*'; | |
if (drupal_match_path($path, $patterns) || drupal_match_path($path_alias, $patterns)) { | |
// Do things. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment