Problem/Motivation

Right now EntityReferenceItem hardcodes dependencies from the DefaultSelection selection handler. Concretely, is using the DefaultSelection handler target_bundles to build a list of dependencies, regardless of what effective handler is used by that field. But there are other selection handlers not extending DefaultSelection, like ViewsSelection (or even custom selection handlers) that have no target_bundles setting (that belongs only to DefaultSelection). Those selection handlers are exposing other settings that are creating dependencies. Such dependencies are ignored when EntityReferenceItem calculates the field configuration dependencies. For example an entity reference field that uses a ViewsSelection selection handler should depend on the view that is configured in the field configuration. But right now in HEAD is not adding that view as dependency.

Proposed resolution

  1. Allow EntityReferenceItem to ask their selection handler plugin for dependencies when they calculate the field dependencies.
  2. Move the DefaultSelection specific dependencies from EntityReferenceItem into DefaultSelection.
  3. Introduce a new interface DependencyRemovalPluginInterface having an onDependencyRemoval() method.
  4. Make SelectionPluginBase implement also DependencyRemovalPluginInterface interface.
  5. Implement a generic onDependencyRemoval() that only returns FALSE in SelectionPluginBase.
  6. Create PluginRemovedDependencyTrait and move EntityDisplayBase::getPluginRemovedDependencies() there. This can be reused now in other similar cases.
  7. Implement calculateDependencies() in ViewsSelection.
  8. In EntityReferenceItem set the selection handler to broken when the dependency is deleted and cannot be resolved.

Remaining tasks

None.

User interface changes

None.

API changes

  1. New interface DependencyRemovalPluginInterface having an onDependencyRemoval() method.
  2. SelectionPluginBase implements now also DependencyRemovalPluginInterface interface.
  3. New trait PluginRemovedDependencyTrait.

Data model changes

None.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

claudiu.cristea created an issue. See original summary.

claudiu.cristea’s picture

Status: Active » Needs review
FileSize
36.17 KB
claudiu.cristea’s picture

Version: 8.3.x-dev » 8.2.x-dev
Issue summary: View changes
claudiu.cristea’s picture

Issue summary: View changes
claudiu.cristea’s picture

Issue summary: View changes

Status: Needs review » Needs work

The last submitted patch, 2: 2786841-2.patch, failed testing.

The last submitted patch, 2: 2786841-2.patch, failed testing.

claudiu.cristea’s picture

Status: Needs work » Needs review
FileSize
7.09 KB
37.53 KB

Fixed.

claudiu.cristea’s picture

FileSize
1.51 KB
37.53 KB

Nits.

Status: Needs review » Needs work

The last submitted patch, 9: 2786841-9.patch, failed testing.

claudiu.cristea’s picture

Status: Needs work » Needs review

Test from #9 passed.

claudiu.cristea’s picture

Issue summary: View changes
claudiu.cristea’s picture

amateescu’s picture

claudiu.cristea’s picture

@amateescu, thank you for pointing me to that. However, this issue seems a little bit different in terms of proposed solution. Here we're not only adding missed dependencies but we are introducing a mechanism that asks the plugin to provide its dependencies and we're also let the plugin react on dependency removal. If this issue gets committed, the other one becomes obsolete. For this reason and also because here we have a better, detailed IS I would prefer to keep this alive while marking the other as duplicate.

If you feel I'm wrong, please re-activate the other.

Updated also the IS after opened #2787873: Add a base class for entity reference selection handlers and fix the structure of their configuration.

jibran’s picture

Title: Entity reference fields should ask their selection handler plugin for dependencies » Entity reference fields should add selection handler config dependencies

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

claudiu.cristea’s picture

Version: 8.3.x-dev » 8.4.x-dev
Status: Postponed » Needs work
jibran’s picture

Status: Needs work » Postponed

That got reverted.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

jibran’s picture

Status: Postponed » Needs review
jibran’s picture

Status: Needs review » Needs work

I meant NW.

jibran’s picture

Issue tags: +Needs reroll
jofitz’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
28.84 KB

Re-rolled.

Status: Needs review » Needs work

The last submitted patch, 24: 2786841-24.patch, failed testing. View results

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

jibran’s picture

Version: 8.6.x-dev » 8.5.x-dev
jibran’s picture

FileSize
28.91 KB

YARR(yet another reroll)

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

claudiu.cristea’s picture

Assigned: Unassigned » claudiu.cristea

Assigning.

jibran’s picture

Assigned: claudiu.cristea » Unassigned
Issue tags: +DrupalSouth 2018
jibran’s picture

Status: Needs work » Needs review
FileSize
28.99 KB

YARR(yet another reroll)

jibran’s picture

Version: 8.6.x-dev » 8.8.x-dev
FileSize
13.53 KB
27.99 KB

This might fix some fails.

Status: Needs review » Needs work

The last submitted patch, 33: 2786841-33.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

jibran’s picture

Status: Needs work » Needs review
FileSize
3.93 KB
28.04 KB

CS fixes.

Status: Needs review » Needs work

The last submitted patch, 35: 2786841-35.patch, failed testing. View results

jibran’s picture

Status: Needs work » Needs review
FileSize
733 bytes
28.03 KB

Fixed a deprecation warning.

Status: Needs review » Needs work

The last submitted patch, 37: 2786841-37.patch, failed testing. View results

andypost’s picture

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.