0

In Drupal 7 it was possible to include into one node (/node/x/edit) the following lines

Label 1
[view:adresses=block_1=argument1]
Label 2
[view:adresses=block_1=argument2]
Label 3
[view:adresses=block_1=argument3]

Result: Output of the view depending on the argument.

I need the same solution in Drupal 8! How can I realize this?

Maybe entitity reference can solve this but I am able to use entity reference in Drupal 7 but in Drupal 8 this does not work (or I don't know how).

In Drupal 7 there are other modules like "View reference", "Viewfield" ... to solve this in a similar way.

But how can I solve this in Drupal 8? The output (e.g. block) of a view should be displayed in the content of one specific node.

How can I create a node field with a reference to my adresses view output? Thank you.

1
  • 1
    The only reason that was possible was via token and extended token integrations to allow you to insert a token into a WYSIWYG. That certainly wasn't core behavior on its own. Reference fields are now preferred. – Kevin Sep 21 '16 at 19:47
1

I solved the problem by myself:

I use the modules Twig tweak and Twig input filter

to solve the problem above in Drupal 8. Works fine.

0

Try this :

function views_embed_view($name, $display_id = 'default') {
  $args = func_get_args();
  array_shift($args); // remove $name
  if (count($args)) {
    array_shift($args); // remove $display_id
  }

  $view = views_get_view($name);
  if (!$view || !$view->access($display_id)) {
    return;
  }

  return $view->preview($display_id, $args);
}

https://api.drupal.org/api/views/views.module/function/views_embed_view/7.x-3.x

2

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.