This file contains 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
// Is the current route/path the front page? | |
if ($is_front = \Drupal::service('path.matcher')->isFrontPage()) {} | |
// Need to know what the current page's requested path was, as opposed to the route? You can do this: | |
$current_uri = \Drupal::request()->getRequestUri(); | |
// Need to redirect to a specific page? | |
use Drupal\Core\Controller\ControllerBase; | |
class MyControllerClass extends ControllerBase { |
This file contains 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
/** | |
* Implements hook_views_pre_view(). | |
*/ | |
function cgap_search_views_pre_view(ViewExecutable $view, $display_id, array &$args) { | |
$view->element['#cache']['contexts'] = ['url.path', 'url.query_args']; | |
} |