Elgg  Version 5.1
Go to the documentation of this file.
1 <?php
30 function elgg_define_js(string $name, array $config): void {
31  $src = elgg_extract('src', $config);
33  if (!empty($src)) {
35  _elgg_services()->amdConfig->addPath($name, $url);
36  }
38  // shimmed module
39  if (isset($config['deps']) || isset($config['exports'])) {
40  _elgg_services()->amdConfig->addShim($name, $config);
41  }
42 }
52 function elgg_require_js(string $name): void {
53  _elgg_services()->amdConfig->addDependency($name);
54 }
64 function elgg_unrequire_js(string $name): void {
65  _elgg_services()->amdConfig->removeDependency($name);
66 }
76 function elgg_require_css(string $view): void {
77  $view_name = "{$view}.css";
78  if (!elgg_view_exists($view_name)) {
79  $view_name = $view;
80  }
82  elgg_register_external_file('css', $view, elgg_get_simplecache_url($view_name));
83  elgg_load_external_file('css', $view);
84 }
94 function elgg_unrequire_css(string $view): void {
95  elgg_unregister_external_file('css', $view);
96 }
109 function elgg_register_external_file(string $type, string $name, string $url, string $location = ''): bool {
110  if (empty($location)) {
111  $location = $type === 'js' ? 'footer' : 'head';
112  }
114  return _elgg_services()->externalFiles->register($type, $name, $url, $location);
115 }
126 function elgg_unregister_external_file(string $type, string $name): bool {
127  return _elgg_services()->externalFiles->unregister($type, $name);
128 }
139 function elgg_load_external_file(string $type, string $name): void {
140  _elgg_services()->externalFiles->load($type, $name);
141 }
152 function elgg_get_loaded_external_resources(string $type, string $location): array {
153  return _elgg_services()->externalFiles->getLoadedResources($type, $location);
154 }
elgg_require_css(string $view)
Register a CSS view name to be included in the HTML head.
elgg_define_js(string $name, array $config)
Helper functions for external files like css/js.
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
Display a page in an embedded window.
Definition: iframe.php:8
Definition: delete.php:22
elgg_register_external_file(string $type, string $name, string $url, string $location= '')
Core registration function for external files.
elgg_extract($key, $array, $default=null, bool $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:254
Advanced site settings, debugging section.
Definition: debugging.php:6
elgg_unrequire_js(string $name)
Cancel a request to load an AMD module onto the page.
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_load_external_file(string $type, string $name)
Load an external resource for use on this page.
Definition: member.php:29
elgg_unrequire_css(string $view)
Unregister a CSS view name to be included in the HTML head.
foreach($plugin_guids as $guid) if(empty($deactivated_plugins)) $url
Definition: deactivate.php:39
Get the global service provider.
Definition: elgglib.php:346
elgg_get_loaded_external_resources(string $type, string $location)
Get external resource descriptors.
elgg_normalize_url(string $url)
Definition: output.php:163
elgg_require_js(string $name)
Request that Elgg load an AMD module onto the page.
elgg_get_simplecache_url(string $view, string $subview= '')
Get the URL for the cached view.
Definition: cache.php:139
elgg_view_exists(string $view, string $viewtype= '', bool $recurse=true)
Returns whether the specified view exists.
Definition: views.php:152