Problem/Motivation
Would it be possible to make the sitewide_alert entity fieldable?
I'm going through stackexchange to see if i can find any tips on how to do this - no luck so far. When i find it i'll submit a patch.
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | make_fieldable-3243392-2.patch | 5.12 KB | liquidcms |
Issue fork sitewide_alert-3243392
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
liquidcms commentedI was stumped by why the changes i made weren't having the intended affect until, thanks to @4k4 on Drupal Answers who picked up on that the module specifically has a routing alter to make sure the field UI is suppressed. It even has these comments:
// Disable access to field UI for Sitewide Alerts.
// Currently adding and configuring fields has little effect.
This is an awesome module so i am hoping that the project maintainer will understand that this is the entire point of Drupal and the Field API.. to make things extensible. With all due respect; it is unlikely you could possibly imagine all the use cases for this module. As an example, our use case: Our client wants the alert banner message to be cloickable to go to the Active Alerts page which is a view that lists "extended" details available for each alert. Obviously this module and the Alert entity are an excellent fit for this except that we need an additional field to add "alert details".
This patch does a few things:
- removes the redundant settings route that existed
- renamed the admin config route which was being used to map to std Drupal entity format to allow adding in field ui tabs
- removed the Route code which was overriding the natural Field UI interface
- possibly a couple small formatting changes to match Drupal coding stds.
Missing: Right now the Field UI shows up under the Global Settings form that was originally there; but the additional menu items don't show up in the admin menu. This should liikely get fixed but i wasnt too worried about it.
Also, patch is against 8.x-dev. I see there is a 2.x branch but not released; so wasnt sure if i should use that.
Comment #3
chrissnyderComment #4
chrissnyderThank you for getting started on the patch.
When making the sitewide alerts fieldable, I would also like to make sure that the fields directly related to the functionality are somehow separated in the edit UI to make sure that the site editor/admin's UX is not negatively impacted by the additional fields. Maybe we can do something like the node edit form does and move it to the sidebar.
Comment #6
chrissnyderComment #8
chrissnyderComment #9
liquidcms commentedi read comment "make sure that the fields directly related to the functionality are somehow separated in the edit UI " but then also saw committed - so guessing you decided not important.
imho, the separation also assumes knowing every instance of how this module would be used. For example, my application is to add an Alert Details formatted textarea field. That would only make sense to be at the top of the form and would not fit in the sidebar. Btw, the sidebar is not typically available except for node entities (silly D8 decision; there is core patch to remove this limitation which i use on the Alerts form to better arrange the fields).
thanks for committing.
Comment #10
chrissnyderI with this commit I did some separation of some of the fields to move them into to vertical tabs section of the entity edit form. Other fields are still displayed at the top of the form.
I agree that it was a silly decision in D8 to only add the sidebar on the entity forms to node entities. IMO: I like the sidebar thing in some cases and core should add it as an optional thing for all entity types.
Thank you for your work on the patch.
Comment #11
liquidcms commentedthanks for getting these patches committed.. i'll upgrade to the 2.x release and check them out tomorrow.