It's not always possible to use a path to determine block visibility.
Therefore, here is how you programmatically disable a block on specific view without recourse to path.
/** * Implements hook_preprocess_HOOK(). */ function tns_breadcrumb_preprocess_page(&$vars) { // Remove block from all content that isn't a specific view. $view_id = Drupal::request()->attributes->get('view_id'); if (empty($view_id) || $view_id == 'myviewID') { if (isset($vars['page']['myregion']['myblock'])) { // You have to look around and figure out where your block is. unset($vars['page']['myregion']['myblock']); } } }
If you want to use parameters from the node to determine visibility, do:
$node = Drupal::request()->attributes->get('node');
References: