I have made a custom block and i want to make it visible only to pages that follow this pattern: user/[user-id]/galleries.
Is there a way to do it?
There are Visibility settings for blocks in Drupal. One of options is "Show block on specific pages". Select "Only the listed pages" and input user/*/galleries
In the Page specific visibility settings, select Show if the following PHP code returns TRUE (PHP-mode, experts only) and enter
return arg(0) === 'user'
&& is_numeric(arg(1))
&& arg(2) === 'galleries'
&& arg(3) === null;
in the Pages text input field. Skip the && arg(3) === null
part if you also want to display the block on pages further down in the hierarchy (e.g. on user/[user-id]/galleries/private
).