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.
I would like to create a block on my site similar to the maintainers block on each Drupal.org project page. I reviewed the documentation but did not see a way of doing this without modification. I made a slight change to project.views.inc and added hook_views_data() implementation to expose a relationship between project nodes and maintainer user entities.
Comment | File | Size | Author |
---|---|---|---|
#4 | 1896166-add_project_maintainers_views_relationship-1896166-4.patch | 8.37 KB | mattreba |
#1 | project-add_project_maintainers_views_relationship-1896166-1.patch | 1.34 KB | mattreba |
Comments
Comment #1
mattreba CreditAttribution: mattreba commentedComment #2
dwwCurrently, that maintainers block on d.o is from versioncontrol_project. See #1007102: [META] Port versioncontrol_project to D7 for progress on that, although you probably don't want/need a dependency on VCAPI for your site.
So yes, I think it'd be a lovely thing to expose this to views so folks could make their own block without VCAPI.
In fact, I'd be happy to have a default view that provides a simple maintainers block that sites could enable if they wanted. So, once you get your view working, please export it and post it as a patch here, too. ;)
Do we want/need to expose more fields for this? E.g. what permissions each maintainer has?
Related (but not a dup nor a blocker): #1090056: Show a version of the maintainers tab for all (auth?) users
Thanks!
-Derek
Comment #3
mattreba CreditAttribution: mattreba commentedThanks for the response. I had guessed it might be in versioncontrol_project since it had number of commits. I was thinking about the same thing last night after I posted this. A user might want to sort based on permissions or add icons to differentiate the primary owner(s) from other maintainers. I'll post up another patch later today.
I'm having good luck with the project and project_issue so far on my D7 site. Thanks for all the hard work.
Comment #4
mattreba CreditAttribution: mattreba commentedAdded update_project and administer_maintainers fields. Added default_view for project_maintainers.
I must admit the views API is a bit new to me. I joined project_maintainer to the node view which has the side affect of having these two new fields show up as available fields in any node view. If you have suggestions on a better way to make this information available without mucking about in the node view please let me know.
Comment #4.0
mattreba CreditAttribution: mattreba commentedFixed typo in hook name
Comment #5
drumm#2358371: Declare project_maintainers table for views added similar code.