Undefined array key "delete"

Created on 22 January 2024, 11 months ago
Updated 29 January 2024, 10 months ago

Problem/Motivation

Warning: Undefined array key "delete" in Drupal\inline_entity_form\Plugin\Field\FieldWidget\InlineEntityFormComplex::submitConfirmRemove() (line 1013)

Steps to reproduce

Remove any IEF. (ief_remove_confirm)

Proposed resolution

Check if delete exists in array.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Needs review

Version

3.0

Component

Code

Created by

🇵🇹Portugal saidatom Lisbon

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

Merge Requests

Comments & Activities

  • Issue created by @saidatom
  • Merge request !106Undefined array key "delete" → (Open) created by saidatom
  • Status changed to Needs review 11 months ago
  • Pipeline finished with Success
    11 months ago
    Total: 518s
    #80978
  • Status changed to RTBC 11 months ago
  • 🇬🇷Greece idimopoulos

    For reference, this is reproducible only if the user does not have the access to delete the entity removed. In web/modules/contrib/inline_entity_form/src/Plugin/Field/FieldWidget/InlineEntityFormComplex.php:914 there is a check already

        if (!empty($entity_id) && $this->getSetting('removed_reference') === self::REMOVED_OPTIONAL && $entity->access('delete')) {
    

    and the delete checkbox is not added if the user does not have 'delete' access. This, checking either for the access or if the array key exists is a valid case.
    I don't know if tests are needed as this is a warning and a simple missing check that does not affect the end result. The user does not have access, the entity is also not marked for deletion.

  • Status changed to Needs work 10 months ago
  • 🇩🇪Germany geek-merlin Freiburg, Germany

    Thx a lot, this makes a lot of sense.

    But code is overly complex. Please use the more idiomatic !empty($form_values['delete'])

  • First commit to issue fork.
  • Pipeline finished with Success
    10 months ago
    Total: 611s
    #83942
  • Status changed to Needs review 10 months ago
Production build 0.71.5 2024