Problem/Motivation

The issue #3293384: Respect selected language for alert proposed that alerts only show on pages that match the alert language, but there are also use cases where it is desirable for translated pages to display an untranslated alert.

For example, a page for a public park needs an alert because of a wildfire, zombie apocalypse or other life-threatening emergency. The alert needs to go on the site, but there isn't time to have the content translated. It should be possible to display the alert in the original language on translated pages.

Proposed resolution

Add a configuration option to fall back on the original language, set to false by default. This way, the current behavior is retained when the module is updated.

In SitewideAlertManager::activeSitewideAlerts, check the configuration before filtering the collection on the current language.

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

calebtr created an issue. See original summary.

chrissnyder’s picture

Status: Active » Needs review
arantxio’s picture

Status: Needs review » Needs work

I've tested this and it seems to be working, but i think it would be better if we add a option on the specific alerts once this is enabled. Now it will always show untranslated items, even if you don't want it to.

calebtr’s picture

If that level of customization is needed, it might be better to replace the query with a view. Is there room in the roadmap for that?

smustgrave’s picture

Version: 2.x-dev » 3.0.x-dev
Issue tags: +Needs tests
chrissnyder’s picture

Status: Needs work » Closed (outdated)

This issue hasn't received any significant updates in the past 12 months. If you think it is still relevant, you are encouraged to reopen and update it.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

calebtr’s picture

Status: Closed (outdated) » Active

Re-opening because we still need and use this functionality. I'm happy to work on tests, but I had asked module maintainers for advice on the best approach.

@arantxio suggested in #4 (#3389209-4: Make behavior of alerts on translated pages configurable) that this behavior should be configurable on a per-alert basis.

Translation behavior isn't typically configured on an entity-by-entity basis, at least not for content. But we could satisfy that use case if a site added a custom field and displayed a list of alerts from a view.

So, module maintainers, does it make sense to work on using a view for this module instead of a db query?

If not, do you agree with @arantxio's comment?

calebtr’s picture

Status: Active » Needs review

johan den hollander made their first commit to this issue’s fork.

johan den hollander’s picture

To make this compatible with the 3.1 version I first commited on the MR branch, but this may not be the right way. I could not find a way to create 3.1.x fork for this issue. So instead I added a 3.1.x patch.

chrissnyder’s picture

Version: 3.0.x-dev » 3.1.x-dev

chrissnyder changed the visibility of the branch 2.x to hidden.

chrissnyder changed the visibility of the branch 3.1.x to hidden.

chrissnyder’s picture

Thank you for the patch Johan! I created and pushed up a new 3.1.x branch with this change.

chrissnyder changed the visibility of the branch 3389209-make-behavior-of to hidden.

  • chrissnyder committed 8a08dc17 on 3.1.x
    Issue #3389209: Add option to show untranslated alerts
    
chrissnyder’s picture

Status: Needs review » Reviewed & tested by the community
chrissnyder’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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