Create/Update Labels buttons naming improvement

Created on 11 March 2022, over 2 years ago
Updated 9 December 2023, 11 months ago

Problem/Motivation

If you have an entity reference type field (media) with multiple types ,using complex inline form in this case will have Add new , add existing , create , update on all types.
so can lead user to misconfiguration.

Steps to reproduce

Add an entity reference field at the content type ,media type or custom block
Check multiple types at field configuration level
Go to Manage form display=>choose the field and change it to
After trying to add content to this field we will get a form in another form with unclear text buttons
I will give you an example with the images:
We have 4 types of media slides, video, Youku, and youtube when I choose a type, I get a common text "Add new media item" for all types. (You can see the picture attached media.png)
We have the same problem, if we click on the button "add new media item" we will have the same text "create new media" for all types. (You can see the picture attached youtube.png)

Proposed resolution

Modify Widget to adapt the fields if the webmaster checks "Overriden labels" the solution is:
Add a select with 2 options:
1) Leave the default behavior of the module
2) Custom a simple text for all types
3) Give the webmaster to enter the singular and plural text for each type we have on the field

Remaining tasks

User interface changes

API changes

Data model changes

šŸ› Bug report
Status

Needs work

Version

3.0

Component

Code

Created by

šŸ‡²šŸ‡¦Morocco flemsoudi

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

Comments & Activities

Not all content is available!

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

  • Open in Jenkins ā†’ Open on Drupal.org ā†’
    Core: 10.0.7 + Environment: PHP 8.2 & MySQL 8
    last update over 1 year ago
    Patch Failed to Apply
  • Status changed to Needs work over 1 year ago
  • šŸ‡ŗšŸ‡¦Ukraine podarok Ukraine
    git apply change-labels-buttons-naming-IEF-complex-3269087-4.patch 
    error: inline_entity_form/inline_entity_form.module: No such file or directory
    error: inline_entity_form/src/Plugin/Field/FieldWidget/InlineEntityFormBase.php: No such file or directory
    error: inline_entity_form/src/Plugin/Field/FieldWidget/InlineEntityFormComplex.php: No such file or directory

    needs reroll

  • First commit to issue fork.
  • @shivam_tiwari opened merge request.
  • Status changed to Needs review over 1 year ago
  • Status changed to Fixed over 1 year ago
  • šŸ‡ŗšŸ‡¦Ukraine podarok Ukraine

    tnx

  • šŸ‡ÆšŸ‡“Jordan Rajab Natshah Jordan

    Facing issues with "Add existing item" or "Add existing node"
    āŒ Automated unit/functional testing coverage

      @javascript @init @tools @local @development @staging
      Scenario: Add Test content N1, N2, N3 nodes to the Test Queue entityqueue
        Given I am a logged in user with the "webmaster" user
        When I go to "/admin/structure/entityqueue"
        And I wait
        Then I should see "Test Queue"
        When I click "Edit items" in the "Test Queue" row
        And I wait
        Then I should see "Edit subqueue Test Queue"
        When I press "Add existing item"
          Button with id|name|title|alt|value "Add existing item" not found. 
    
    
    

    "Configure simple text" was sat for "Choose config labels buttons" in "Widget settings: Inline entity form - Complex" for a selected field in an entity.

    The following code has no conditions to switch between custom labels.

    /**
     * Change text button by type of bundle.
     *
     * @param array $form
     *   The complete parent form.
     * @param \Drupal\Core\Form\FormStateInterface $form_state
     *   The form state of the parent form.
     */
    function inline_entity_form_change_bundle_form(array $form, FormStateInterface $form_state) {
      $element = inline_entity_form_get_element($form, $form_state);
      $elements = $form_state->getTriggeringElement();
    
      $element['actions']['ief_add']['#value'] = t('Add new @type', [
        '@type' => $elements['#options'][$elements['#value']],
      ]);
      return $element;
    }
    

    Any change of config is needed after the update? or this is an issue after the change?

  • Status changed to Needs work over 1 year ago
  • šŸ‡ŗšŸ‡¦Ukraine podarok Ukraine
  • šŸ‡ŗšŸ‡øUnited States justcaldwell Austin, Texas

    Before I found this issue, I created šŸ› Complex widget's "Add existing..." does not use label override Active , which I think accounts for what's happening in #14.

  • šŸ‡©šŸ‡ŖGermany geek-merlin Freiburg, Germany

    Bulk reassign.

Production build 0.71.5 2024