Skip to content
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

Carry over default fields when creating a new alert banner type #108

Open
andybroomfield opened this issue Jan 19, 2021 · 5 comments
Open
Labels
enhancement New feature or request help wanted Extra attention is needed
Milestone

Comments

@andybroomfield
Copy link
Contributor

Currently when a site builder creates a new alert banner type, they get the stripped down version of title, and the display control checkboxes.

The extra fields such as kind of alert and link are not avalible by default (they can be added as fields).
Would a better starting point be to carry over the same fields as the default alert banner type, such as when using bundle copy.

This is partly due to moving the fields into config, which would be better kept, however there should be a way of duplicating fields from an entity.

screencapture-localgov-lndo-site-8000-admin-content-alert-banner-add-localgov-alert-banner-2021-01-19-11_32_26
Localgov alert banner

screencapture-localgov-lndo-site-8000-admin-content-alert-banner-add-test-2021-01-19-11_32_47
New alert banner type.

@andybroomfield
Copy link
Contributor Author

@finnlewis
Copy link
Member

@Iam-Jam fancy looking?

@j4-m
Copy link
Contributor

j4-m commented Jan 25, 2021

@andybroomfield I've just taken a look at this but I'll need some more context before I can make a suggestion\work on it...

Is the functionality provided by the module the module dependent on the Link, Short description and Type of alert fields, from what I can see in the source I would suggest that it is to a certain extent, if so then I would suggest managing these fields as 'base fields' that way they would exist for all bundles and we can guarantee their existence.

If in fact we really do want these fields to be optional, i.e. admins can delete them after creating a new bundle, then I suspect we'll want to extend the AlertBannerEntityType class with implementation of preCreate (maybe) where we programmatically create the field configurations...

@j4-m
Copy link
Contributor

j4-m commented Jan 25, 2021

Worth saying that if we go with base fields then we're probably going to have to think about a migration path for installations which use the field base\instances...

@andybroomfield
Copy link
Contributor Author

If in fact we really do want these fields to be optional, i.e. admins can delete them after creating a new bundle, then I suspect we'll want to extend the AlertBannerEntityType class with implementation of preCreate (maybe) where we programmatically create the field configurations...

Hi @Iam-Jam They are meant to be managed fields in config, as there are use cases where those fields are not present. They are definalty optional (but suggested) fields for new banner types. The issue is that when creating a new banner, it would be better to have them present by default and allow site builders to delete them, instead of site builders having to re-add these fields, if that is something that is possible.

If not I would continue with as we have now, keeping these fields as config.

@andybroomfield andybroomfield added enhancement New feature or request help wanted Extra attention is needed labels Apr 14, 2021
@andybroomfield andybroomfield added this to the v1.1 milestone May 10, 2021
stephen-cox added a commit that referenced this issue Jun 9, 2021
* Added Condition Field module (#137)

* Added visibility field (#137)

* Patch condition_field for missing schema: https://www.drupal.org/project/condition_field/issues/3215202

* Copy configuration for visibility field to new alert banner types (#137 #108)

* Only use the request_path plugin for controlling banner visibility.

Includes update path for field_condition schema. See: https://www.drupal.org/project/condition_field/issues/3215202#comment-14117352

* Added update hook to add visibility field to existing alert banners

* Add visibility field to all existing localgov_alert_banner bundles

Co-authored-by: Andy Broomfield <andy.broomfield@brighton-hove.gov.uk>
@andybroomfield andybroomfield modified the milestones: v1.1, v1.8 Nov 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants