class TokenConverter in Devel 4.x
Same name and namespace in other branches
- 8.3 webprofiler/src/Routing/TokenConverter.php \Drupal\webprofiler\Routing\TokenConverter
- 8 webprofiler/src/Routing/TokenConverter.php \Drupal\webprofiler\Routing\TokenConverter
- 8.2 webprofiler/src/Routing/TokenConverter.php \Drupal\webprofiler\Routing\TokenConverter
Class TokenConverter.
Hierarchy
- class \Drupal\webprofiler\Routing\TokenConverter implements ParamConverterInterface
Expanded class hierarchy of TokenConverter
1 string reference to 'TokenConverter'
- webprofiler.services.yml in webprofiler/
webprofiler.services.yml - webprofiler/webprofiler.services.yml
1 service uses TokenConverter
File
- webprofiler/
src/ Routing/ TokenConverter.php, line 11
Namespace
Drupal\webprofiler\RoutingView source
class TokenConverter implements ParamConverterInterface {
/**
* {@inheritdoc}
*/
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;
}
/**
* {@inheritdoc}
*/
public function applies($definition, $name, Route $route) {
if (!empty($definition['type']) && $definition['type'] === 'webprofiler:token') {
return TRUE;
}
return FALSE;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
TokenConverter:: |
public | function |
Determines if the converter applies to a specific route and variable. Overrides ParamConverterInterface:: |
|
TokenConverter:: |
public | function |
Converts path variables to their corresponding objects. Overrides ParamConverterInterface:: |