Elgg\Assets\ExternalFiles::load PHP Méthode

load() public méthode

Load an external resource for use on this page
public load ( string $type, string $name ) : void
$type string Type of file: js or css
$name string The identifier for the file
Résultat void
    public function load($type, $name)
    {
        $this->bootstrap($type);
        $name = trim(strtolower($name));
        $item = elgg_extract($name, $GLOBALS['_ELGG']->externals_map[$type]);
        if ($item) {
            // update a registered item
            $item->loaded = true;
        } else {
            $item = new \stdClass();
            $item->loaded = true;
            $item->url = '';
            $item->location = '';
            if (elgg_view_exists($name)) {
                $item->url = elgg_get_simplecache_url($name);
                $item->location = $type == 'js' ? 'foot' : 'head';
            }
            $GLOBALS['_ELGG']->externals[$type]->add($item);
            $GLOBALS['_ELGG']->externals_map[$type][$name] = $item;
        }
    }