function EntityDisplayBase::getPluginRemovedDependencies
Returns the plugin dependencies being removed.
The function recursively computes the intersection between all plugin dependencies and all removed dependencies.
Note: The two arguments do not have the same structure.
Parameters
array[] $plugin_dependencies: A list of dependencies having the same structure as the return value of ConfigEntityInterface::calculateDependencies().
array[] $removed_dependencies: A list of dependencies having the same structure as the input argument of ConfigEntityInterface::onDependencyRemoval().
Return value
array A recursively computed intersection.
See also
\Drupal\Core\Config\Entity\ConfigEntityInterface::calculateDependencies()
\Drupal\Core\Config\Entity\ConfigEntityInterface::onDependencyRemoval()
2 calls to EntityDisplayBase::getPluginRemovedDependencies()
- EntityDisplayBase::onDependencyRemoval in core/
lib/ Drupal/ Core/ Entity/ EntityDisplayBase.php  - Informs the entity that entities it depends on will be deleted.
 - LayoutBuilderEntityViewDisplay::onDependencyRemoval in core/
modules/ layout_builder/ src/ Entity/ LayoutBuilderEntityViewDisplay.php  - Informs the entity that entities it depends on will be deleted.
 
File
- 
              core/
lib/ Drupal/ Core/ Entity/ EntityDisplayBase.php, line 516  
Class
- EntityDisplayBase
 - Provides a common base class for entity view and form displays.
 
Namespace
Drupal\Core\EntityCode
protected function getPluginRemovedDependencies(array $plugin_dependencies, array $removed_dependencies) {
  $intersect = [];
  foreach ($plugin_dependencies as $type => $dependencies) {
    if ($removed_dependencies[$type]) {
      // Config and content entities have the dependency names as keys while
      // module and theme dependencies are indexed arrays of dependency names.
      // @see \Drupal\Core\Config\ConfigManager::callOnDependencyRemoval()
      if (in_array($type, [
        'config',
        'content',
      ])) {
        $removed = array_intersect_key($removed_dependencies[$type], array_flip($dependencies));
      }
      else {
        $removed = array_values(array_intersect($removed_dependencies[$type], $dependencies));
      }
      if ($removed) {
        $intersect[$type] = $removed;
      }
    }
  }
  return $intersect;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.