public function AdminPathConfigEntityConverter::convert
public AdminPathConfigEntityConverter::convert($value, $definition, $name, array $defaults)
Converts path variables to their corresponding objects.
Parameters
mixed $value: The raw value.
mixed $definition: The parameter definition provided in the route options.
string $name: The name of the parameter.
array $defaults: The route defaults array.
Return value
mixed|null The converted parameter value.
Overrides EntityConverter::convert
File
- core/lib/Drupal/Core/ParamConverter/AdminPathConfigEntityConverter.php, line 61
Class
- AdminPathConfigEntityConverter
- Makes sure the unmodified ConfigEntity is loaded on admin pages.
Namespace
Drupal\Core\ParamConverterCode
public function convert($value, $definition, $name, array $defaults) { $entity_type_id = $this->getEntityTypeFromDefaults($definition, $name, $defaults); // If the entity type is dynamic, confirm it to be a config entity. Static // entity types will have performed this check in self::applies(). if (strpos($definition['type'], 'entity:{') === 0) { $entity_type = $this->entityManager->getDefinition($entity_type_id); if (!$entity_type->isSubclassOf('\Drupal\Core\Config\Entity\ConfigEntityInterface')) { return parent::convert($value, $definition, $name, $defaults); } } if ($storage = $this->entityManager->getStorage($entity_type_id)) { // Make sure no overrides are loaded. return $storage->loadOverrideFree($value); } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!ParamConverter!AdminPathConfigEntityConverter.php/function/AdminPathConfigEntityConverter::convert/8.1.x