The view has on offset based on a value set in the Basic page node.

function domain_config_bu_views_query_alter(ViewExecutable $view, QueryPluginBase $query) {
    if($node = \Drupal::routeMatch()->getParameter('node')) {
      if(... // Node has certain field value set) {

On a page request i can get the current node object by routeMatch() functionality.
But views has ajax enabled, and on ajax callback routeMatch() does not return the node object. Wich is normal. But how can i get the current node object/ nid in an ajax callback so the offset is respected?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.