Feature #91715

Make new AssetCollector class searchable

Added by Luis GarcĂ­a 16 days ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Frontend
Target version:
-
Start date:
2020-06-26
Due date:
% Done:

0%

PHP Version:
7.3
Tags:
AssetCollector
Complexity:
no-brainer
Sprint Focus:

Description

Sometimes the generation of inline code is quite heavy and one wants to avoid doing it multiple times. In my opinion, the class "TYPO3\CMS\Core\Page\AssetCollector" from TYPO3 10+ should have methods to query the internal status of the class.

The existence of a generated inline JavaScript could be asked by using a hypothetical "hasInlineJavaScript(string $identifier): bool" method, thus avoiding to generate it again when used multiple times during the same request.

An analog method "getInlineJavaScript" could also be of some use, but I still didn't found any advantage for it.

Possible implementation of proposed methods:

public function hasInlineJavaScript(string $identifier): bool
{
    return isset($this->inlineJavaScripts[$identifier]);
}

public function getInlineJavaScript(string $identifier): ?array
{
    return $this->inlineJavaScripts[$identifier] ?? null;
}

Also available in: Atom PDF