0

I am using Drupal 8. Added new view My Vocabulary and created a contextual filter with paragraph ID. Now I need to render the view with passed parameters to contextual filter. What hook to use to solve my problem. Thanks.

2
  • can you explain what do you want to achieve exactly ? where do you want to render this view and so on ?
    – berramou
    Commented May 29, 2020 at 19:23
  • I created My Vocabulary page. This page must be loaded with a contextual filter. This contextual filter takes IDs. Commented May 29, 2020 at 19:29

1 Answer 1

1

Use hook_views_pre_view

function mymodule_views_pre_view(\Drupal\views\ViewExecutable $view, $display_id, array &$args) {
  // Modify contextual filters for view_name.
  $paragraph_id = 22;
  if ($view->id() == 'view_name') {
    $args = [$paragraph_id]; // args must be an array.
  }
}

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.