TokenConverter.php in Devel 8
File
webprofiler/src/Routing/TokenConverter.php
View source
<?php
namespace Drupal\webprofiler\Routing;
use Drupal\Core\ParamConverter\ParamConverterInterface;
use Symfony\Component\Routing\Route;
class TokenConverter implements ParamConverterInterface {
public function convert($value, $definition, $name, array $defaults) {
$profiler = \Drupal::service('profiler');
if (NULL === $profiler) {
return NULL;
}
$profile = $profiler
->loadProfile($value);
if (NULL === $profile) {
return NULL;
}
return $profile;
}
public function applies($definition, $name, Route $route) {
if (!empty($definition['type']) && $definition['type'] === 'webprofiler:token') {
return TRUE;
}
return FALSE;
}
}