Elgg  Version master
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Elgg\Assets\ExternalFiles Class Reference

External files service. More...

Public Member Functions

 __construct (protected Config $config, protected Urls $urls, protected ViewsService $views, protected SimpleCache $simpleCache, protected SystemCache $serverCache)
 Constructor. More...
 
 register (string $type, string $name, string $url, string $location)
 Core registration function for external files. More...
 
 unregister (string $type, string $name)
 Unregister an external file. More...
 
 load (string $type, string $name)
 Load an external resource for use on this page. More...
 
 getLoadedResources (string $type, string $location)
 Get external resource descriptors. More...
 
 reset ()
 Unregister all files. More...
 

Protected Member Functions

 setupType (string $type)
 Bootstraps the externals data structure. More...
 
 getSubResourceIntegrity (string $type, string $resource)
 Returns the integrity related to the resource file. More...
 

Protected Attributes

array $files = []
 
 $sri
 

Detailed Description

External files service.

Definition at line 17 of file ExternalFiles.php.

Constructor & Destructor Documentation

Elgg\Assets\ExternalFiles::__construct ( protected Config  $config,
protected Urls  $urls,
protected ViewsService  $views,
protected SimpleCache  $simpleCache,
protected SystemCache  $serverCache 
)

Constructor.

Parameters
Config$configconfig
Urls$urlsurls service
ViewsService$viewsviews service
SimpleCache$simpleCachesimplecache
SystemCache$serverCacheserver cache

Definition at line 37 of file ExternalFiles.php.

Member Function Documentation

Elgg\Assets\ExternalFiles::getLoadedResources ( string  $type,
string  $location 
)

Get external resource descriptors.

Parameters
string$typeType of file: js or css
string$locationPage location
Returns
string[] Resources to load

Definition at line 148 of file ExternalFiles.php.

Elgg\Assets\ExternalFiles::getSubResourceIntegrity ( string  $type,
string  $resource 
)
protected

Returns the integrity related to the resource file.

Parameters
string$typetype of resource
string$resourcename of resource
Returns
string|NULL

Definition at line 200 of file ExternalFiles.php.

Elgg\Assets\ExternalFiles::load ( string  $type,
string  $name 
)

Load an external resource for use on this page.

Parameters
string$typeType of file: js or css
string$nameThe identifier for the file
Returns
void

Definition at line 115 of file ExternalFiles.php.

Elgg\Assets\ExternalFiles::register ( string  $type,
string  $name,
string  $url,
string  $location 
)

Core registration function for external files.

Parameters
string$typeType of external resource (js or css)
string$nameIdentifier used as key
string$urlURL
string$locationLocation in the page to include the file
Returns
bool

Definition at line 56 of file ExternalFiles.php.

Elgg\Assets\ExternalFiles::reset ( )

Unregister all files.

Returns
void

Definition at line 177 of file ExternalFiles.php.

Elgg\Assets\ExternalFiles::setupType ( string  $type)
protected

Bootstraps the externals data structure.

Parameters
string$typeThe type of external, js or css.
Returns
void

Definition at line 187 of file ExternalFiles.php.

Elgg\Assets\ExternalFiles::unregister ( string  $type,
string  $name 
)

Unregister an external file.

Parameters
string$typeType of file: js or css
string$nameThe identifier of the file
Returns
bool

Definition at line 94 of file ExternalFiles.php.

Member Data Documentation

array Elgg\Assets\ExternalFiles::$files = []
protected

Definition at line 19 of file ExternalFiles.php.

Elgg\Assets\ExternalFiles::$sri
protected

Definition at line 26 of file ExternalFiles.php.


The documentation for this class was generated from the following file: