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

Command icon 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

liquidcms created an issue. See original summary.

liquidcms’s picture

Version: 2.x-dev » 8.x-1.x-dev
Status: Active » Needs review
StatusFileSize
new5.12 KB

I 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.

chrissnyder’s picture

Version: 8.x-1.x-dev » 2.x-dev
chrissnyder’s picture

Title: Fieldable? » Allow Sitewide Alerts to be Fieldable
Status: Needs review » Needs work

Thank 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.

chrissnyder’s picture

  • chrissnyder committed e79a99f on 2.x
    Issue #3243392 by chrissnyder, liquidcms: Allow Sitewide Alerts to be...
chrissnyder’s picture

Status: Needs work » Fixed
liquidcms’s picture

i 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.

chrissnyder’s picture

StatusFileSize
new117.69 KB

I 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.

sitewide alert vertical tab fields

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.

liquidcms’s picture

thanks for getting these patches committed.. i'll upgrade to the 2.x release and check them out tomorrow.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.