public function AdminPathConfigEntityConverter::applies in Zircon Profile 8
Same name in this branch
- 8 core/lib/Drupal/Core/ParamConverter/AdminPathConfigEntityConverter.php \Drupal\Core\ParamConverter\AdminPathConfigEntityConverter::applies()
- 8 core/lib/Drupal/Core/ProxyClass/ParamConverter/AdminPathConfigEntityConverter.php \Drupal\Core\ProxyClass\ParamConverter\AdminPathConfigEntityConverter::applies()
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/ParamConverter/AdminPathConfigEntityConverter.php \Drupal\Core\ParamConverter\AdminPathConfigEntityConverter::applies()
Determines if the converter applies to a specific route and variable.
Parameters
mixed $definition: The parameter definition provided in the route options.
string $name: The name of the parameter.
\Symfony\Component\Routing\Route $route: The route to consider attaching to.
Return value
bool TRUE if the converter applies to the passed route and parameter, FALSE otherwise.
Overrides EntityConverter::applies
File
- core/
lib/ Drupal/ Core/ ParamConverter/ AdminPathConfigEntityConverter.php, line 88 - Contains \Drupal\Core\ParamConverter\AdminPathConfigEntityConverter.
Class
- AdminPathConfigEntityConverter
- Makes sure the unmodified ConfigEntity is loaded on admin pages.
Namespace
Drupal\Core\ParamConverterCode
public function applies($definition, $name, Route $route) {
if (isset($definition['with_config_overrides']) && $definition['with_config_overrides']) {
return FALSE;
}
if (parent::applies($definition, $name, $route)) {
$entity_type_id = substr($definition['type'], strlen('entity:'));
// If the entity type is dynamic, defer checking to self::convert().
if (strpos($entity_type_id, '{') === 0) {
return TRUE;
}
// As we only want to override EntityConverter for ConfigEntities, find
// out whether the current entity is a ConfigEntity.
$entity_type = $this->entityManager
->getDefinition($entity_type_id);
if ($entity_type
->isSubclassOf('\\Drupal\\Core\\Config\\Entity\\ConfigEntityInterface')) {
return $this->adminContext
->isAdminRoute($route);
}
}
return FALSE;
}