0

I have a View containing the latest news in a very standard way (ie: one below the other)... I would like to inject, at certain points, other blocks containing other views (ie: latest news with a certain tag), like in this image:

https://i.sstatic.net/3c9Dw.jpg

An easy but impractical approach would be to create different views: one for the latest 2, then one for another 3 news with an offset of 2, etc...

But is there some magic that the new D8 theme layer can do to make this more practical?

2
  • 1
    There is no additional functionality in D8 Views that makes this version specific. Commented Feb 11, 2014 at 2:35
  • ok, tag "8" removed.
    – Sifro
    Commented Feb 11, 2014 at 16:18

1 Answer 1

0

You could create a new View field in modules/yourmodule/lib/Drupal/yourmodule/Plugin/views/Field and "attach" it via hook_views_data_alter() or hook_views_data(). This field would returns a hardcoded view or dynamic, depends on your needs. Another way would be to use Views templates.

3
  • It would be great if you could expand the views template answer a bit. ... Show how to use a preprocess function for the new variable and how you could expand the template. Commented Feb 10, 2014 at 18:35
  • i will study the hook_views_data_alter more carefully then as i've never used it... i do use views templates though, but i can't understand how to use them to achieve what i need... maybe i can define a block region in a views template?
    – Sifro
    Commented Feb 11, 2014 at 16:18
  • See api.drupal.org/api/drupal/…
    – user21641
    Commented Feb 11, 2014 at 23:33

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.