Make the edit warning message more user friendly for non-technical users

Created on 27 January 2021, over 3 years ago
Updated 19 April 2024, 2 months ago

The current warning that is (optionally) shown when editing an entity is written from a developer's perspective and can be confusing to end users who don't necessarily understand the "entity" concept.

Modifications on this form will affect all existing usages of this entity.

Consider changing it to more user-friendly language as proposed:

Changing this @bundle will affect all places that it appears. Alternatively, remove this @bundle from the original content and add a new one.

✨ Feature request
Status

Needs review

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States aasarava

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡³πŸ‡±Netherlands ricovandevin

    What I have also noticed is that the link in the message is going to the entity_usage.usage_list route while the local tab is going to the entity.$entity_type_id.entity_usage route. The former does not show the other tabs for the entity and the link opens in a new browser tab making it hard to browse back.

  • Merge request !60Made warning messages configurable β†’ (Open) created by ricovandevin
  • Open on Drupal.org β†’
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 8
    last update 7 months ago
    Waiting for branch to pass
  • Status changed to Needs review 7 months ago
  • Open on Drupal.org β†’
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 8
    last update 7 months ago
    Waiting for branch to pass
  • πŸ‡³πŸ‡±Netherlands ricovandevin

    MR adds config fields for the edit and delete warning messages. It also adds two tokens that can be used the display then entity's bundle name and the URL to the usage page for the entity (the version with the tabs).

    Patch attached for Composer based workflows.

  • Status changed to Needs work 2 months ago
  • πŸ‡ΊπŸ‡ΈUnited States justcaldwell

    This would be a nice improvement! #6 works for me on content entities (nodes), but fails on Media entities with:

    Error: Call to a member function label() on null in entity_usage_tokens() (line 200 of modules/contrib/entity_usage/entity_usage.module).
    call_user_func_array(Object, Array) (Line: 409)
    Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object, 'entity_usage') (Line: 388)
    Drupal\Core\Extension\ModuleHandler->invokeAllWith('tokens', Object) (Line: 408)
    Drupal\Core\Extension\ModuleHandler->invokeAll('tokens', Array) (Line: 364)
    Drupal\Core\Utility\Token->generate('entity-usage', Array, Array, Array, Object) (Line: 241)
    Drupal\Core\Utility\Token->doReplace(1, 'Changing this [entity-usage:entity-bundle] will affect <a href="usage-url]" target="_blank">everywhere it appears</a>. Alternatively, remove this [entity-usage:entity-bundle] from the original content and add a new one.', Array, Array, Object) (Line: 191)
    Drupal\Core\Utility\Token->replace('Changing this [entity-usage:entity-bundle] will affect <a href="usage-url]" target="_blank">everywhere it appears</a>. Alternatively, remove this [entity-usage:entity-bundle] from the original content and add a new one.', Array, Array, NULL) (Line: 18)
    Drupal\token_or\Token->replace('Changing this [entity-usage:entity-bundle] will affect <a href="usage-url]" target="_blank">everywhere it appears</a>. Alternatively, remove this [entity-usage:entity-bundle] from the original content and add a new one.', Array) (Line: 117)
    entity_usage_form_alter(Array, Object, 'media_image_edit_form') (Line: 545)
    Drupal\Core\Extension\ModuleHandler->alter('form', Array, Object, 'media_image_edit_form') (Line: 841)
    Drupal\Core\Form\FormBuilder->prepareForm('media_image_edit_form', Array, Object) (Line: 284)
    Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
    Drupal\Core\Controller\FormController->getContentResult(Object, Object) (Line: 39)
    Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult(Object, Object)
    call_user_func_array(Array, Array) (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 627)
    Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
    Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
    Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
    Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 106)
    Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
    Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
    Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
    Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
  • Status changed to Needs review 2 months ago
  • πŸ‡ΊπŸ‡ΈUnited States justcaldwell

    The construct $entity->type->entity->label() may not be reliable across entity types. The latest change makes use of the entity_type.bundle.info service to fetch the label instead. Back to NR.

  • πŸ‡ΊπŸ‡ΈUnited States justcaldwell

    Updated patch.

Production build 0.69.0 2024