public function TokenConverter::convert in Devel 8
Same name and namespace in other branches
- 8.3 webprofiler/src/Routing/TokenConverter.php \Drupal\webprofiler\Routing\TokenConverter::convert()
- 8.2 webprofiler/src/Routing/TokenConverter.php \Drupal\webprofiler\Routing\TokenConverter::convert()
- 4.x webprofiler/src/Routing/TokenConverter.php \Drupal\webprofiler\Routing\TokenConverter::convert()
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 ParamConverterInterface::convert
File
- webprofiler/
src/ Routing/ TokenConverter.php, line 16
Class
- TokenConverter
- Class TokenConverter
Namespace
Drupal\webprofiler\RoutingCode
public function convert($value, $definition, $name, array $defaults) {
// "profiler" service isn't injected to prevent circular reference when
// more than one language is active and "Account administration pages" is
// enabled on admin/config/regional/language/detection. See #2710787 for
// more information.
/** @var \Drupal\webprofiler\Profiler\Profiler $profiler */
$profiler = \Drupal::service('profiler');
if (NULL === $profiler) {
return NULL;
}
$profile = $profiler
->loadProfile($value);
if (NULL === $profile) {
return NULL;
}
return $profile;
}