Skip to content
Snippets Groups Projects

Issue #3481590: Views EntityReference filter: Add functionality to switch from select to autocomplete widget when a max number of options reached

Issue #3481590: Views EntityReference filter: Add functionality to switch from select to autocomplete widget when a max number of options reached

Closes #3481590

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
643 661
644 662 // Set the validated exposed input from the select list when not the all
645 663 // value option.
646 if ($this->options['widget'] == static::WIDGET_SELECT) {
664 if ($this->options['widget'] == static::WIDGET_SELECT && $form[$identifier]['#type'] !== 'entity_autocomplete') {
  • Checking the field type without first checking whether $form[$identifier] exists or not causes a Warning that on a website with a lot of traffic (where I have applied this patch) has caused the logs to grow by 18GB (75 million lines). Here the warnings:

    • Warning: Undefined array key "location" in Drupal\views\Plugin\views\filter\EntityReference->validateExposed() (line 664 of core/modules/views/src/Plugin/views/filter/EntityReference.php)
    • Warning: Trying to access array offset on null in Drupal\views\Plugin\views\filter\EntityReference->validateExposed() (line 664 of core/modules/views/src/Plugin/views/filter/EntityReference.php)

    I think that by adding a simple isset() we avoid that problem.

  • Diego Marrufo Rodríguez changed this line in version 4 of the diff

    changed this line in version 4 of the diff

  • Please register or sign in to reply
  • added 1 commit

    • b9dcbf43 - Added isset() method to prevent mass warnings

    Compare with previous version

  • Please register or sign in to reply
    Loading