EntityBrowserController.php:

  • Added $operation = NULL; and $form_state = NULL; initialization to prevent PHP undefined variable warnings when neither 'edit' nor 'default' form classes exist

    EntityReferenceBrowserWidget.php:

    • Extracted three new helper methods: getTargetEntityTypeId(), getTargetEntityType(), and targetEntityTypeHasEditForm()
    • Replaced all 8 occurrences of $this->fieldDefinition->getFieldStorageDefinition()->getSetting('target_type') with $this->getTargetEntityTypeId() (including displayCurrentSelection() and getPersistentData(), which the original patch missed)
    • Replaced the file-entity-specific edit button hack with the generic targetEntityTypeHasEditForm() check in both settingsForm() and displayCurrentSelection()
    • Moved the edit button access computation out of the array_map closure (computed once), while keeping the per-entity $entity->access('update') check inline

Closes #2868196

Merge request reports

Loading