class RoutingDataCollector in Devel 4.x
Same name and namespace in other branches
- 8.3 webprofiler/src/DataCollector/RoutingDataCollector.php \Drupal\webprofiler\DataCollector\RoutingDataCollector
- 8 webprofiler/src/DataCollector/RoutingDataCollector.php \Drupal\webprofiler\DataCollector\RoutingDataCollector
- 8.2 webprofiler/src/DataCollector/RoutingDataCollector.php \Drupal\webprofiler\DataCollector\RoutingDataCollector
Provides a data collector which shows all available routes.
Hierarchy
- class \Drupal\webprofiler\DataCollector\RoutingDataCollector extends \Symfony\Component\HttpKernel\DataCollector\DataCollector implements DrupalDataCollectorInterface uses StringTranslationTrait
Expanded class hierarchy of RoutingDataCollector
1 string reference to 'RoutingDataCollector'
- webprofiler.services.yml in webprofiler/
webprofiler.services.yml - webprofiler/webprofiler.services.yml
1 service uses RoutingDataCollector
File
- webprofiler/
src/ DataCollector/ RoutingDataCollector.php, line 15
Namespace
Drupal\webprofiler\DataCollectorView source
class RoutingDataCollector extends DataCollector implements DrupalDataCollectorInterface {
use StringTranslationTrait, DrupalDataCollectorTrait;
/**
* The route profiler.
*
* @var \Drupal\Core\Routing\RouteProviderInterface
*/
protected $routeProvider;
/**
* Constructs a new RoutingDataCollector.
*
* @param \Drupal\Core\Routing\RouteProviderInterface $routeProvider
* The route provider.
*/
public function __construct(RouteProviderInterface $routeProvider) {
$this->routeProvider = $routeProvider;
}
/**
* {@inheritdoc}
*/
public function collect(Request $request, Response $response, \Exception $exception = NULL) {
$this->data['routing'] = [];
foreach ($this->routeProvider
->getAllRoutes() as $route_name => $route) {
// @TODO Find a better visual representation.
$this->data['routing'][] = [
'name' => $route_name,
'path' => $route
->getPath(),
];
}
}
/**
* @return int
*/
public function getRoutesCount() {
return count($this
->routing());
}
/**
* Twig callback for displaying the routes.
*/
public function routing() {
return $this->data['routing'];
}
/**
* {@inheritdoc}
*/
public function getTitle() {
return $this
->t('Routing');
}
/**
* {@inheritdoc}
*/
public function getName() {
return 'routing';
}
/**
* {@inheritdoc}
*/
public function getPanelSummary() {
return $this
->t('Defined routes: @route', [
'@route' => $this
->getRoutesCount(),
]);
}
/**
* {@inheritdoc}
*/
public function getIcon() {
return 'iVBORw0KGgoAAAANSUhEUgAAABUAAAAcCAYAAACOGPReAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAPxJREFUeNrkVsERREAQ7D0koXwlIAISkIGXvwAkoJSfHITg5SMUVR4eMuCxZ1xxV+5uuTL30lV8bPX09PSuFVJKcOOGP+DipLrrusoFdV1Lz/NgmiaKosC0XrAopYT0fc/f/jAMa41Pj23bkrpi9bRpGmRZ9lRKFSzLkl9UHMI4jijLcuaaSZMkQdd1fNMn5r0EHIFhGEjTlDenYRjCcZyHUnqRwXEcz77sYepM+Z1yTOEXZEFVVYcUba2iItsNcbr9IAiw5HMd1CJZtU1VpG3bIooi3gPF933keY43pb9gb1Bskdrap58luMjvRNO04wcK18RfIa59mbgLMAASuWsKAyoEhgAAAABJRU5ErkJggg==';
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DrupalDataCollectorInterface:: |
public | function | 8 | |
DrupalDataCollectorInterface:: |
public | function | 1 | |
DrupalDataCollectorInterface:: |
public | function | Returns the libraries needed in detail panel. | 2 |
DrupalDataCollectorInterface:: |
public | function | Returns true if this datacollector has a detail panel. | 2 |
RoutingDataCollector:: |
protected | property | The route profiler. | |
RoutingDataCollector:: |
public | function | ||
RoutingDataCollector:: |
public | function |
Returns the collector icon in base64 format. Overrides DrupalDataCollectorInterface:: |
|
RoutingDataCollector:: |
public | function |
Returns the name of the collector. Overrides DrupalDataCollectorInterface:: |
|
RoutingDataCollector:: |
public | function |
Returns the string used in vertical tab summary. Overrides DrupalDataCollectorInterface:: |
|
RoutingDataCollector:: |
public | function | ||
RoutingDataCollector:: |
public | function |
Returns the datacollector title. Overrides DrupalDataCollectorInterface:: |
|
RoutingDataCollector:: |
public | function | Twig callback for displaying the routes. | |
RoutingDataCollector:: |
public | function | Constructs a new RoutingDataCollector. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 4 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |