function ConfigDependencies::onDependencyRemoval

Same name in other branches
  1. 9 core/modules/rest/src/Entity/ConfigDependencies.php \Drupal\rest\Entity\ConfigDependencies::onDependencyRemoval()
  2. 8.9.x core/modules/rest/src/Entity/ConfigDependencies.php \Drupal\rest\Entity\ConfigDependencies::onDependencyRemoval()
  3. 11.x core/modules/rest/src/Entity/ConfigDependencies.php \Drupal\rest\Entity\ConfigDependencies::onDependencyRemoval()

Informs the entity that entities it depends on will be deleted.

Parameters

\Drupal\rest\RestResourceConfigInterface $rest_config: The rest configuration.

array $dependencies: An array of dependencies that will be deleted keyed by dependency type. Dependency types are, for example, entity, module and theme.

Return value

bool TRUE if the entity has been changed as a result, FALSE if not.

See also

\Drupal\Core\Config\Entity\ConfigEntityInterface::onDependencyRemoval()

File

core/modules/rest/src/Entity/ConfigDependencies.php, line 127

Class

ConfigDependencies
Calculates rest resource config dependencies.

Namespace

Drupal\rest\Entity

Code

public function onDependencyRemoval(RestResourceConfigInterface $rest_config, array $dependencies) {
    $granularity = $rest_config->get('granularity');
    switch ($granularity) {
        case RestResourceConfigInterface::METHOD_GRANULARITY:
            return $this->onDependencyRemovalForMethodGranularity($rest_config, $dependencies);
        case RestResourceConfigInterface::RESOURCE_GRANULARITY:
            return $this->onDependencyRemovalForResourceGranularity($rest_config, $dependencies);
        default:
            throw new \InvalidArgumentException('Invalid granularity specified.');
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.