Undefined array key "delete"

Created on 22 January 2024, 5 months ago
Updated 29 January 2024, 5 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 5 months ago
  • ๐Ÿ‡ต๐Ÿ‡นPortugal saidatom Lisbon
  • Pipeline finished with Success
    5 months ago
    Total: 518s
    #80978
  • Status changed to RTBC 5 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 5 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'])

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia kbk1992 Hyderabad

    bharath-kondeti โ†’ made their first commit to this issueโ€™s fork.

  • Pipeline finished with Success
    5 months ago
    Total: 611s
    #83942
  • Status changed to Needs review 5 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia kbk1992 Hyderabad
Production build 0.69.0 2024