class TokenConverter
Class TokenConverter
Hierarchy
- class \Drupal\webprofiler\Routing\TokenConverter implements \Drupal\Core\ParamConverter\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
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
TokenConverter::applies | public | function | |
TokenConverter::convert | public | function |