Elgg  Version 6.1
external_files.php
Go to the documentation of this file.
1 <?php
15 function elgg_import_esm(string $name): void {
16  _elgg_services()->esm->import($name);
17 }
18 
29 function elgg_register_esm(string $name, string $href): void {
30  _elgg_services()->esm->register($name, $href);
31 }
32 
41 function elgg_require_css(string $view): void {
42  $view_name = "{$view}.css";
43  if (!elgg_view_exists($view_name)) {
44  $view_name = $view;
45  }
46 
47  elgg_register_external_file('css', $view, elgg_get_simplecache_url($view_name));
48  elgg_load_external_file('css', $view);
49 }
50 
62 function elgg_register_external_file(string $type, string $name, string $url, string $location = ''): bool {
63  if (empty($location)) {
64  $location = $type === 'js' ? 'footer' : 'head';
65  }
66 
67  return _elgg_services()->externalFiles->register($type, $name, $url, $location);
68 }
69 
79 function elgg_unregister_external_file(string $type, string $name): bool {
80  return _elgg_services()->externalFiles->unregister($type, $name);
81 }
82 
92 function elgg_load_external_file(string $type, string $name): void {
93  _elgg_services()->externalFiles->load($type, $name);
94 }
95 
105 function elgg_get_loaded_external_resources(string $type, string $location): array {
106  return _elgg_services()->externalFiles->getLoadedResources($type, $location);
107 }
elgg_require_css(string $view)
Register a CSS view name to be included in the HTML head.
if(!$user||!$user->canDelete()) $name
Definition: delete.php:22
elgg_unregister_external_file(string $type, string $name)
Unregister an external file.
c Accompany it with the information you received as to the offer to distribute corresponding source complete source code means all the source code for all modules it plus any associated interface definition plus the scripts used to control compilation and installation of the executable as a special the source code distributed need not include anything that is normally and so on of the operating system on which the executable unless that component itself accompanies the executable If distribution of executable or object code is made by offering access to copy from a designated then offering equivalent access to copy the source code from the same place counts as distribution of the source even though third parties are not compelled to copy the source along with the object code You may not or distribute the Program except as expressly provided under this License Any attempt otherwise to sublicense or distribute the Program is void
Definition: LICENSE.txt:215
$type
Definition: delete.php:21
elgg_register_external_file(string $type, string $name, string $url, string $location= '')
Core registration function for external files.
if(!empty($avatar)&&!$avatar->isValid()) elseif(empty($avatar)) if(!$owner->saveIconFromUploadedFile('avatar')) if(!elgg_trigger_event('profileiconupdate', $owner->type, $owner)) $view
Definition: upload.php:39
elgg_import_esm(string $name)
Helper functions for external files like css/js.
elgg_register_esm(string $name, string $href)
Registers an ES module to the import map.
elgg_load_external_file(string $type, string $name)
Load an external resource for use on this page.
$location
Definition: member.php:29
foreach($plugin_guids as $guid) if(empty($deactivated_plugins)) $url
Definition: deactivate.php:39
_elgg_services()
Get the global service provider.
Definition: elgglib.php:353
elgg_get_loaded_external_resources(string $type, string $location)
Get external resource descriptors.
elgg_get_simplecache_url(string $view)
Get the URL for the cached view.
Definition: cache.php:78
elgg_view_exists(string $view, string $viewtype= '', bool $recurse=true)
Returns whether the specified view exists.
Definition: views.php:131