Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
See #1880976: [meta] Port examples (including submodules) to D9.4+
Review views_examples (see #1883776: Port views examples to D8) and views_plugin_examples (see #1883780: Port views plugin examples to D8).
- Data integration: Exposing a table in your module to Views with a
hook_views_data()
. - Data handlers: Examples of field, filter, and argument handlers would go well with #1).
- Other plugin examples: E.g., a style plugin.
Please edit this summary to make this list more accurate
Proposed resolution
Remaining tasks
- Check the #2209627: [meta] Module Checklist for Examples for items missed below
- We need views_example.module file. This needs a @defgroup for the API site, and a bunch of text describing what the module does, what it demonstrates, and how to see it in action. #1883760-6: New examples for views on D8
- We also need a
page which will show us the view in action, and enough textual information to let a newbie know if they're even looking at the right thing. #1883760-6: New examples for views on D8 - Examples of field, filter, and argument handlers would go well with #1) #1883760-12: New examples for views on D8
- Example Style plugin example #1883760-10: New examples for views on D8
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#13 | interdiff-1883760-3-13.txt | 1.06 KB | clemens.tolboom |
#13 | examples-views-1883760-13.patch | 23.73 KB | clemens.tolboom |
#3 | interdiff-1883760-1-3.patch | 13.32 KB | blazey |
#3 | examples-views_examples_default_view-3.patch | 23.02 KB | blazey |
#1 | examples-hook_views_data-1883760-1.patch | 10.27 KB | blazey |
Comments
Comment #0.0
marvil07 CreditAttribution: marvil07 commentedLinks to other full projects which exemplify views
Comment #0.1
marvil07 CreditAttribution: marvil07 commentedLink to issues on example modules for views.
Comment #0.2
xjmUpdated issue summary.
Comment #0.3
xjmUpdated issue summary.
Comment #1
blazey CreditAttribution: blazey commentedAttaching patch for 1). It contains hook_schema and corresponding hook_views_data implementation. hook_views_data template was taken from views.api.php.
Comment #3
blazey CreditAttribution: blazey commentedAdded default view using fields defined in hook_views_data.
Comment #6
Mile23Thanks for moving forward on this, @blazey.
If you name the interdiff as 'interdiff.txt', the testbot won't try and test it.
OK, this is a huge file of YML with no comments. We need a description of what this file is for, why given values were used, etc.
I know D8 doesn't necessarily need a .module file any more, but Examples does. We need a @defgroup for the API site, and a bunch of text describing what the module does, what it demonstrates, and how to see it in action.
We also need a page which will show us the view in action, and enough textual information to let a newbie know if they're even looking at the right thing.
See also the Examples module checklist: #2209627: [meta] Module Checklist for Examples
Also tests. :-) The test run failed because of branch blockers.
Comment #8
TechNikh CreditAttribution: TechNikh commentedIf anyone landed on this issue like me looking for views integration with content_entity_example
https://www.drupal.org/node/2192175#comment-10758756
Comment #9
lukas.fischer CreditAttribution: lukas.fischer commentedYes, please add "views_data" = "Drupal\views\EntityViewsData" to the examples code.
Comment #10
Mikael Berger CreditAttribution: Mikael Berger as a volunteer commentedHello,
Hopefully this is the right place to post a suggestion, it has not been easy to find active discussions on views plugin examples.
I have a sandbox project at Uikit Slideshow which I think might be suitable as a Views Style Plugin Example. Albeit developed for a particular use case, it also shows how to pick individual fields in the views row and then employ them in the plugin's Twig template.
If you find my suggestion to be appropriate, please bear in mind that I am a newbie module developer. Needless to say, this means that I maybe would need some help and advise for moving towards Drupal's full project standards.
Cheers
Mikael
Comment #11
Mile23Comment #12
bucefal91 CreditAttribution: bucefal91 at Ocelot commentedHello, guys!
Just recently I published a series of articles targeted to Drupal developers interested in advanced views integration for D8. https://medium.com/@oleksandr.trotsenko/drupal-8-views-tutorial-for-deve... It would cover points 1 and 2 from the main description of this issue. If you think any of those materials may serve for examples, feel free to grab it.
Comment #13
clemens.tolboomAdded to get listed on the Examples toolbar and menu links.
Comment #14
clemens.tolboomComment #15
clemens.tolboomComment #16
clemens.tolboomThe medium post by @bucefal91 in #12 looks great to reuse here. For relationship we need an extra table.
So maybe we could better change to the tables done by @bucefal91 and take over his code?
@bucefal91 I'm not sure I can take your code in here as there is no license. I guess you can but not sure.
Comment #18
clemens.tolboomWow ... 8 days waiting ... weird.
@bucefal91 any thoughts?
Comment #19
bucefal91 CreditAttribution: bucefal91 at Ocelot commented@clemens.tolboom, hey!
Ufff :) I've been on a tight schedule since May finishing a project, so I didn't really follow activities on issue queues of d.org. Hence my belated response.
Definitely take my code samples! I wrote that series exactly for that purpose - for the purpose of education and helping others. If somebody considers it useful enough to base views examples on it, that'd be just awesome! :)
I cannot promise I will do adapting myself in the nearest month or so because I am still not through with that project on my work, but if time allows me and nobody else has done, I'll be happy to de it myself too.
Comment #20
rcodina CreditAttribution: rcodina commentedPatch on #13 just helped me a lot. Thank you all!
Comment #21
jungle3.x-dev is the default branch right now.
Comment #22
clemens.tolboom@jungle can you please 'explain' why/how this version came into life. Preferably to a d.o CR link :)
Comment #23
jungle@clemens.tolboom, thanks for asking. FYI:
Copied and pasted from the project page, no CR.
Comment #24
clemens.tolboomThanks ... I checked with https://www.drupal.org/project/examples/releases
So more info is available @valthebald ;-)
I miss the link with #d9readiness effort as to move this issue forward we have to install 9.1.x first :-/
@jungle can you add 9.1-x testing? And publish this 3.x branch on the project page?
Comment #25
jungleSo instead of adding testing against 9.1.x, I did add testing with 9.0.x
Sorry, I have minimal maintainer privileges ATM, so unable to do it myself. But I will pass this message to @valthebald.
Thanks!
Comment #26
valthebaldMoving to new examples meta