class AssetsDataCollector in Devel 8.2
Same name and namespace in other branches
- 8.3 webprofiler/src/DataCollector/AssetsDataCollector.php \Drupal\webprofiler\DataCollector\AssetsDataCollector
- 8 webprofiler/src/DataCollector/AssetsDataCollector.php \Drupal\webprofiler\DataCollector\AssetsDataCollector
- 4.x webprofiler/src/DataCollector/AssetsDataCollector.php \Drupal\webprofiler\DataCollector\AssetsDataCollector
Collects data about the used assets (CSS/JS).
Hierarchy
- class \Drupal\webprofiler\DataCollector\AssetsDataCollector extends \Symfony\Component\HttpKernel\DataCollector\DataCollector implements DrupalDataCollectorInterface uses StringTranslationTrait
Expanded class hierarchy of AssetsDataCollector
3 files declare their use of AssetsDataCollector
- AssetsDataCollectorTest.php in webprofiler/
tests/ src/ Unit/ DataCollector/ AssetsDataCollectorTest.php - CssCollectionRendererWrapper.php in webprofiler/
src/ Asset/ CssCollectionRendererWrapper.php - JsCollectionRendererWrapper.php in webprofiler/
src/ Asset/ JsCollectionRendererWrapper.php
1 string reference to 'AssetsDataCollector'
- webprofiler.services.yml in webprofiler/
webprofiler.services.yml - webprofiler/webprofiler.services.yml
1 service uses AssetsDataCollector
File
- webprofiler/
src/ DataCollector/ AssetsDataCollector.php, line 15
Namespace
Drupal\webprofiler\DataCollectorView source
class AssetsDataCollector extends DataCollector implements DrupalDataCollectorInterface {
use StringTranslationTrait, DrupalDataCollectorTrait;
/**
* The app root.
*
* @var string
*/
protected $root;
/**
* Constructs a AssetDataCollector object.
*
* @param string $root
* The app root.
*/
public function __construct($root) {
$this->root = $root;
$this->data['js'] = [];
$this->data['css'] = [];
}
/**
* {@inheritdoc}
*/
public function collect(Request $request, Response $response, \Exception $exception = NULL) {
$this->data['assets']['installation_path'] = $this->root . '/';
}
/**
* @param $jsAsset
*/
public function addJsAsset($jsAsset) {
$this->data['js'] = NestedArray::mergeDeepArray([
$jsAsset,
$this->data['js'],
]);
}
/**
* @param $cssAsset
*/
public function addCssAsset($cssAsset) {
$this->data['css'] = NestedArray::mergeDeepArray([
$cssAsset,
$this->data['css'],
]);
}
/**
* Twig callback to return the amount of CSS files.
*/
public function getCssCount() {
return count($this->data['css']);
}
/**
* Twig callback to return the amount of JS files.
*/
public function getJsCount() {
return count($this->data['js']) - 1;
}
/**
* {@inheritdoc}
*/
public function getName() {
return 'assets';
}
/**
* {@inheritdoc}
*/
public function getTitle() {
return $this
->t('Assets');
}
/**
* {@inheritdoc}
*/
public function getPanelSummary() {
return $this
->t('Total: @count', [
'@count' => $this
->getCssCount() + $this
->getJsCount(),
]);
}
/**
* {@inheritdoc}
*/
public function getIcon() {
return 'iVBORw0KGgoAAAANSUhEUgAAABUAAAAcCAYAAACOGPReAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYxIDY0LjE0MDk0OSwgMjAxMC8xMi8wNy0xMDo1NzowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNS4xIE1hY2ludG9zaCIgeG1wTU06S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cbi8UirtdrNjebzQ6MN/KPfT6f436/Z3XudDp4e3uLlUqFQej37XbL5B7DjqEfthQBAgGzfpTJZJDNZpn0zWbDRgI/eQlOdjGFU1coFIfHGu3Lv90qbrfbXRFpJ4POAVGjh/r09PRCP38l3r3Q62RA/NtV3qb8T/Nn4irQXwIMANMNuV/Q8qbhAAAAAElFTkSuQmCC';
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AssetsDataCollector:: |
protected | property | The app root. | |
AssetsDataCollector:: |
public | function | ||
AssetsDataCollector:: |
public | function | ||
AssetsDataCollector:: |
public | function | Collects data for the given Request and Response. | |
AssetsDataCollector:: |
public | function | Twig callback to return the amount of CSS files. | |
AssetsDataCollector:: |
public | function |
Returns the collector icon in base64 format. Overrides DrupalDataCollectorInterface:: |
|
AssetsDataCollector:: |
public | function | Twig callback to return the amount of JS files. | |
AssetsDataCollector:: |
public | function |
Returns the name of the collector. Overrides DrupalDataCollectorInterface:: |
|
AssetsDataCollector:: |
public | function |
Returns the string used in vertical tab summary. Overrides DrupalDataCollectorInterface:: |
|
AssetsDataCollector:: |
public | function |
Returns the datacollector title. Overrides DrupalDataCollectorInterface:: |
|
AssetsDataCollector:: |
public | function | Constructs a AssetDataCollector object. | |
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 |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
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. |