8

I recently became the administrator of a Drupal site. I am attempting to configure various blocks on the page, and have so far only succeeded in removing them altogether. The configuration menu tells me to enter the 'path' for where I want the block to appear. How do I find the list of path names available for entry? The site has a blog, but entering "blog" or even "blog/*" did not make the block appear on the block.

2 Answers 2

8

To get all the paths you can use, you can use the following code to get all the paths defined from modules:

$items = module_invoke_all('menu');
drupal_alter('menu', $items);
foreach ($items as $path => $info) {
  print preg_replace('/%([a-z0-9_]*)/i', '*', $path);
}

The code will show the path as you enter in the block settings; this means it will change node/%node in node/*, and node/%node/edit in node/*/edit.

About your specific issue, the block could not appear because the block has not been assigned to any theme section, the theme doesn't define the section where the block should appear, or the block is empty. In most cases, modules don't output empty blocks.

5
  • this listing will find paths defined by modules, where /admin/config/search/path will only show content aliases.
    – rymo
    Feb 4, 2014 at 23:51
  • You can put the code above on a file, for example get-paths.php, and then execute it like this: drush php-script get-paths.php
    – dashohoxha
    Jun 2, 2015 at 21:52
  • Wrap the print in an if (!path_is_admin($path)) { if you don't want admin paths. Dec 30, 2015 at 23:12
  • $items = module_invoke_all('menu'); drupal_alter('menu', $items); foreach ($items as $path => $info) { if (!path_is_admin($path)) { print preg_replace('/%([a-z0-9_]*)/i', '*', $path) . "\n"; } } Dec 30, 2015 at 23:12
  • Hrm, this doesn't actually show all the aliases registered. Jan 7, 2016 at 19:05
4

If you have the Path module (core) enabled, there will be a page that lists all URL aliases on the site.

If using Drupal 7: example.com/admin/config/search/path

If using Drupal 6: example.com/admin/build/path

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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