-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a views field handler for project properties from the database. #5820
Comments
PR submitted: backdrop/backdrop#4229 The PR adds a select box to allow the admin to select which setting from the info column to display. Not all settings are provided, and some will only return a value for modules (not for themes). Empty strings are returned if the setting doesn't exist. |
This feature request was prompted by work done for #5791. That issue provides a View to display enabled modules, but some of the information (like version) was not accessible, until this PR. |
Tested in the Tugboat sandbox - works for me. 👍 |
This works great, thanks @argiepiano 🙏🏼 I've left several comments/suggestions in the PR, mainly about:
|
info
column for modules and themes in system
table info
column in the system
table
...the "Dependencies" option outputs the machine name of the dependencies as a comma-separated list. Can we rename that option to "Dependencies (machine names)" and then add another "Dependencies" option that outputs the project names of the dependencies? (use |
Thanks so much for reviewing, @indigoxela and @klonos. @klonos, thanks for clarifying the terminology! I was a bit lost with that. I'll work on incorporating suggestions in the next couple of days. |
Layout template information is not stored in the Can you please clarify, in case I'm not understanding your suggestion? Thanks! |
I just pushed a new, much improved version. I incorporated many of your suggestions. More testing, please! I've added an "Other" input, that allows you to type the name of any additional property not included in the options array. This way you can possibly type new properties. And if necessary, this handler can be modified in the future to expand the options array. I've added several other improvements for flat array properties like tags and dependencies. You can now specify the separator, or order/unordered list. Also dependencies give you the option of outputting machine names or human labels. |
@argiepiano many thanks for your work! 🙏 I just did a quick test this time - still works for me. |
Thanks @docwilmot. The reason it's done this way is that Views field handlers are abstractions of select queries. Since the information handled by this handler comes from a single column ( That said, it is possible to create several "faux" handlers that use We could go that route if it's preferred. The current approach also allows the user to specify a property using a machine name by selecting "Other"; this allows someone to display future properties, or properties that are not already included in the list. |
Honestly, I don't see much benefit in that - it would only bloat the code with handlers that actually do the same re db query, but claim to do something different just by different rendering. |
Just to add to my comment above: there is contrib precedent for an omnibus views handler that has select options like this one: Webform. The "Webform submissions data" handler is a single handler that allows the user to select specific "fields" to display. In Webform's case, I don't really like it, but because it's an ancient (pre-Field API) module, that's their workaround to display "fields" in Views. In this handler's case, since the info properties are stable and well-defined, it's OK. Plus this handler will probably not be used as much as the webform one. |
This PR is looking great, but I do think we need to change the label to "Projects" as recommended by @klonos. After that one-line change the PR looks RTBC! I would prefer the shorter "Project properties". It will be consistent with our other uses of "Projects" in core and the documentation, where some project types may be excluded. Alternate theme engines are not supported in Backdrop, so I worry that including that label here might be confusing for people. I also don't think the omission of some project types is really a problem. Including every type of project that might appear in the system table (profiles, etc) would make the label cumbersome and less usable, even though it may be more technically accurate. |
Thanks, @jenlampton. I've made the requested changes and fixed some style issues pointed out by phpcs. However, the latest PR had a phpcs failure I don't understand (phpcs not found ?). |
I gave this a code review and test and did not find any major issues. One question that occurred to me: This exposes the |
@quicksketch, I've added stylesheets in the latest commit. The PR actually can handle 2D arrays (displayed as multilevel bullets - see image). One aspect I did not hear about from @jenlampton: I followed her suggestion and changed "Module/Theme/Theme engine properties" to "Project properties". However, there are other system views handlers that still use "Module/Theme/Theme". My question: even though this is beyond this issue, should I change ALL labels to "Projects"? |
I would be very much in favor of that change. The length of those titles is difficult to read. I would change to simply |
@quicksketch, I've modified as indicated. I'm wondering if a followup issue to create a filter would be in order? |
It would be neat, but filtering on a serialized column is not an easy task. The new PR looks great. Looks ready to go to me. |
Merged backdrop/backdrop#4229 into 1.x for 1.24.0. Thanks @argiepiano et al! backdrop/backdrop@3c5471d by @argiepiano, @indigoxela, @klonos, @jenlampton, @quicksketch and @docwilmot. |
info
column in the system
table
Description of the need
Backdrop currently provides Views definitions to display module and theme information stored in the
system
database. Currently, it's possible to display theme/modulefilename
,name
,schema_version
,status
andtype
.However, there is no way to display any of the information stored in the
info
column, which includes version, dependencies, backdrop version, tags, etc.This is a request to add such a handler.
Proposed solution
Write a special field handler to display those values. Since the
info
column is a serialized array, there needs to be a special option definition and option form within the handler to select the specific setting to be displayed.Alternatives that have been considered
None.
Draft of feature description for Press Release (1 paragraph at most)
Backdrop now includes a Views field handler to display setting information stored in the module and theme info files.
Minor release update:
Translated strings:
Project filename
Project name
The name of the module/theme/theme engine; e.g. node.
Project type
Project status'
Boolean indicating whether or not this module/theme/theme engine is enabled.
Project properties
Selected properties from the module/theme/theme engine\'s info file.
conclusion suitable for blog post
Backdrop now allows includes Views support for the system table. It's possible to generate a view of your site's enabled modules.
The text was updated successfully, but these errors were encountered: