Project

General

Profile

Actions

Feature #91715

closed

Make new AssetCollector class searchable

Added by Luis García almost 4 years ago. Updated over 1 year ago.

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

100%

Estimated time:
PHP Version:
7.3
Tags:
AssetCollector
Complexity:
easy
Sprint Focus:
Remote Sprint

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;
}
Actions

Also available in: Atom PDF