Ability to customize Entity saved alert message

Created on 5 November 2024, 5 months ago

Problem/Motivation

Currently, there is no configuration form field for editing or changing the entity_saved_in_background_alert_message. If we want to make the sentence reframe better to have UI to update the field.

Steps to reproduce

1. Install the module as normal
2. Enable the node content type entity under Allowed Content Entity Forms
3. Select the required content type
4. Edit an existing node and keep in 2 tabs
5. One tab is edited and saved, and another waits to get an alert message.
6. Currently there is no option to edit the message.

Proposed resolution

Add an option for edit the alert message on config form AutosaveFormSettingsForm.php.

    $form['entity_saved_in_background_alert_message'] = [
      '#type' => 'textarea',
      '#title' => $this->t('Entity saved Alert message(background)'),
      '#default_value' => $config->get('entity_saved_in_background_alert_message'),
      '#description' => $this->t("The message will appears on content entity changed or updated."),
      '#required' => TRUE,
    ];

Remaining tasks

Manual testing

User interface changes

Form UI

API changes

Data model changes

Feature request
Status

Active

Version

1.0

Component

User interface

Created by

🇮🇳India arunkumark Coimbatore

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @arunkumark
  • Merge request !18Adding form element → (Open) created by arunkumark
  • 🇮🇳India arunkumark Coimbatore
  • Status changed to Needs work 3 months ago
  • 🇩🇪Germany hchonov 🇪🇺🇩🇪🇧🇬

    1. You are adding the new message, but not using it anywhere.

    2. Further I think we should add everything to the regular settings file as maybe we should merge the messages file into it - otherwise the edit form looks strange editing two different configs.

  • First commit to issue fork.
  • 🇵🇱Poland dlevchik Poznan, Poland

    The changes to a form were also causing the error with form save:

    TypeError: Cannot access offset of type string on string in Drupal\autosave_form\Form\AutosaveFormSettingsForm->submitForm() (line 226 of modules/custom/autosave_form-3485546/src/Form/AutosaveFormSettingsForm.php).
    

    Fixed that, moved messages forms to separate accordion in the form

    Added entity_saved_as_draft to a messages config, the one that says "A version of this page you were editing at @date was saved as a draft. Do you want to resume editing or discard it?", created hook_update for it

    @hchonov I thought about merging autosave_form.messages into the autosave_form.settings, but won't it be better to separate these things? Plus, if we merge it, some translations and config rewritings on current sites might broke

Production build 0.71.5 2024