Drupal 10, the latest version of the open-source digital experience platform with even more features, is here.Updated: Comment #N
Problem/Motivation
Proposed resolution
Remaining tasks
- Rework the access hooks to show the correct view display
User interface changes
API changes
Original report by @username
When managing platforms, it's useful to know which packages are being used. The Project Status extension for Drush was created to that end. Now that we have Views listing packages, it'd be nice to be able to integrate this into the front-end.
In the 'dev/site-count' branch, I have a very basic implementation that is modelled after the 'Site count' field on platforms. Unfortunately, it's very limited, as it functions at Views' render() function, after the query is complete. As a result, it can't be sorted, which is essential for it to be really useful.










Comments
Comment #1
ergonlogicWe now have a sortable implementation in 'dev/packages-count' branch. Basically, we insert a subquery like so:
It's kinda ugly and could use some error-handling, but it works well enough.
Comment #2
helmo CreditAttribution: helmo commentedI didn't see this straight away on the platform node packages page. I still got the 'Page: Site packages' view result. Extra update hook?
The site count column worked fine in the views preview though.
Comment #3
anarcat CreditAttribution: anarcat commentedComment #4
ergonlogic#2 is actually an issue with #2031747: Properly control Views access. I removed the PHP we were injecting into our blocks, but since access control isn't enforced for UID1, you sometimes get views where they shouldn't be.
Comment #5
ergonlogicActually, the problem in #2 is because we now have 2 views displays that are trying to react to the /node/%/packages path, and the first one is winning. This is resolved by our access plugin, but since this isn't checked for UID1, the admin user will only ever see the basic ('site') packages page. This should work for any other user though.
Merged into 6.x-2.x.
Comment #6
helmo CreditAttribution: helmo commentedAfter installation the user gets a uli for the 'admin' user, and I guess many will keep on using that account.... :(
Comment #7
ergonlogicIIRC, the general indication for Drupal is not to normally operate as UID1, except when performing db updates. I know I find myself doing so a lot though. I believe it is a contributing factor to our roles not having been as useful as they should be now. Maybe we need better documentation to this effect? Either way, though, this is a fairly minor UI degradation when operating as UID1.
Anyway, I've done everything I can think of within the Views UI to get this to work for UID1, but then using an access plugin isn't necessarily the right way to proceed here either. I think we could implement our own display type, extending views_plugin_display_page and overriding execute_hook_menu(). Or perhaps there's a hook_views_alter() for that, but I don't see it.
Another option might be to go back to using a single display for packages, and altering it selectively based on the node type. That is, remove the useless 'status' filter on platform nodes, and remove the confusing 'sites' column from site nodes. Maybe somewhere in hook_views_pre_build() or hook_views_post_build()?
I'm pretty new to Views development though, so I'm open to better ways of proceeding.
Comment #8
helmo CreditAttribution: helmo commentedLets see if we can rework this while we update the views for 7.x
Comment #9
ergonlogicAs per #5 on #2177705: [META] Fix Views integration, I've begun using views and block alter hook with some success. They should work here too.
Comment #17
ergonlogicThis has been fixed for a long time, AFAICT.