class DevelDataCollector in Devel 4.x
Same name and namespace in other branches
- 8.3 webprofiler/src/DataCollector/DevelDataCollector.php \Drupal\webprofiler\DataCollector\DevelDataCollector
- 8 webprofiler/src/DataCollector/DevelDataCollector.php \Drupal\webprofiler\DataCollector\DevelDataCollector
- 8.2 webprofiler/src/DataCollector/DevelDataCollector.php \Drupal\webprofiler\DataCollector\DevelDataCollector
Class DevelDataCollector.
Hierarchy
- class \Drupal\webprofiler\DataCollector\DevelDataCollector extends \Symfony\Component\HttpKernel\DataCollector\DataCollector implements DrupalDataCollectorInterface uses StringTranslationTrait
Expanded class hierarchy of DevelDataCollector
1 string reference to 'DevelDataCollector'
- webprofiler.services.yml in webprofiler/
webprofiler.services.yml - webprofiler/webprofiler.services.yml
1 service uses DevelDataCollector
File
- webprofiler/
src/ DataCollector/ DevelDataCollector.php, line 17
Namespace
Drupal\webprofiler\DataCollectorView source
class DevelDataCollector extends DataCollector implements DrupalDataCollectorInterface {
use StringTranslationTrait, DrupalDataCollectorTrait;
/**
* {@inheritdoc}
*/
public function collect(Request $request, Response $response, \Exception $exception = NULL) {
$this->data['original_url'] = $request
->getPathInfo();
}
/**
* @return string
*/
public function getLinks() {
return $this
->develMenuLinks($this->data['original_url']);
}
/**
* {@inheritdoc}
*/
public function getName() {
return 'devel';
}
/**
* {@inheritdoc}
*/
public function getTitle() {
return $this
->t('Development');
}
/**
* {@inheritdoc}
*/
public function hasPanel() {
return FALSE;
}
/**
* Returns the collector icon in base64 format.
*
* @return string
* The collector icon.
*/
public function getIcon() {
return 'iVBORw0KGgoAAAANSUhEUgAAABYAAAAcCAYAAABlL09dAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bn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I7FV4DN7n4OAAojvRxL+CwvgnkMFG5bj7BUoVv4lUfBWIrxGp9jcoKM4DsQABhZ+A2BPqs61AzEVA/XuQwT1AzElA4Q8g/gJN951EBN13kMFLgJiHgMJvQCwNxOxAvJwIg7+wEBnGv4D4M1TtLyIMBocxMQUyKExnAzEzEHMQof4/C5GxDHJh4qAp3VhpYC4rKCieAbEQlQ1+yzhamY4aTD+DAQIMAFv+MFaJEyYhAAAAAElFTkSuQmCC';
}
/**
* @param string $original_url
*
* @return array Array containing Devel Menu links
* Array containing Devel Menu links
*/
protected function develMenuLinks($original_url) {
// We cannot use injected services here because at this point this
// class is deserialized from a storage and not constructed.
$menuLinkTreeService = \Drupal::service('menu.link_tree');
$rendererService = \Drupal::service('renderer');
$parameters = new MenuTreeParameters();
$parameters
->setMaxDepth(1)
->onlyEnabledLinks();
$tree = $menuLinkTreeService
->load('devel', $parameters);
$manipulators = [
[
'callable' => 'menu.default_tree_manipulators:checkAccess',
],
[
'callable' => 'menu.default_tree_manipulators:generateIndexAndSort',
],
];
$tree = $menuLinkTreeService
->transform($tree, $manipulators);
$links = [];
foreach ($tree as $item) {
/** @var \Drupal\devel\Plugin\Menu\DestinationMenuLink $link */
$link = $item->link;
$renderable = Link::fromTextAndUrl($link
->getTitle(), $link
->getUrlObject())
->toRenderable();
$rendered = $rendererService
->renderPlain($renderable);
$linkString = preg_replace('/\\/profiler\\/(.*)&/', $original_url . '&', $rendered);
$links[] = Markup::create($linkString);
}
return $links;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DevelDataCollector:: |
public | function | ||
DevelDataCollector:: |
protected | function | ||
DevelDataCollector:: |
public | function |
Returns the collector icon in base64 format. Overrides DrupalDataCollectorInterface:: |
|
DevelDataCollector:: |
public | function | ||
DevelDataCollector:: |
public | function |
Returns the name of the collector. Overrides DrupalDataCollectorInterface:: |
|
DevelDataCollector:: |
public | function |
Returns the datacollector title. Overrides DrupalDataCollectorInterface:: |
|
DevelDataCollector:: |
public | function |
Returns true if this datacollector has a detail panel. Overrides DrupalDataCollectorInterface:: |
|
DrupalDataCollectorInterface:: |
public | function | 8 | |
DrupalDataCollectorInterface:: |
public | function | 1 | |
DrupalDataCollectorInterface:: |
public | function | Returns the libraries needed in detail panel. | 2 |
DrupalDataCollectorInterface:: |
public | function | Returns the string used in vertical tab summary. | 21 |
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. |