Convenience function for generating a form from a view in a standard location.This function assumes that the body of the form is located at "forms/$action" and sets the action by default to "action/$action". Automatically wraps the forms/$action view with a <form> tag and inserts the anti-csrf security tokens.
@tip This automatically appends elgg-form-action-name to the form's class. It replaces any slashes with dashes (blog/save becomes elgg-form-blog-save)
This would assume a "login" form body to be at "forms/login" and would set the action of the form to "http://yoursite.com/action/login".
If elgg_view('forms/login') is: <input type="text" name="username" > <input type="password" name="password" >
Then elgg_view_form('login') generates: <form action="http://yoursite.com/action/login" method="post"> ...security tokens... <input type="text" name="username" > <input type="password" name="password" > </form>
<?php
}
}
}
}
}
}
}
}
}
}
}
}
if (!
$timer->hasEnded([
'build page'])) {
}
$timer->begin([__FUNCTION__]);
if ($system_messages->count()) {
$messages = $system_messages->dumpRegister();
];
}
}
$vars[
'page_shell'] = $page_shell;
}
$view =
"resources/{$name}";
}
}
throw new PageNotFoundException();
}
if (!
$timer->hasEnded([
'build page'])) {
}
$timer->begin([__FUNCTION__]);
array_shift(
$vars[
'segments']);
$vars[
'layout'] = $layout_name;
$layout_views = [
"page/layouts/{$layout_name}",
'page/layouts/default',
];
foreach ($layout_views as $layout_view) {
break;
}
}
}
unset(
$vars[
'menu_view']);
}
if (!
$menu instanceof Menu) {
throw new ElggInvalidArgumentException('$menu must be a menu name, a Menu, or UnpreparedMenu');
}
"navigation/menu/{$name}",
'navigation/menu/default',
];
}
}
return '';
}
'full_view' => true,
];
}
$entity_subtype =
$entity->getSubtype();
$entity_views = [
"{$entity_type}/{$entity_subtype}",
"{$entity_type}/default",
];
foreach ($entity_views as
$view) {
break;
}
}
}
}
}
}
}
'full_view' => true,
];
return '';
}
$annotation_views = [
"annotation/{$name}",
'annotation/default',
];
foreach ($annotation_views as
$view) {
}
}
return '';
}
'items' => $entities,
'list_class' => 'elgg-list-entity',
'full_view' => true,
'pagination' => true,
'list_type' => $list_type,
'limit' => null,
];
$vars[
'pagination'] =
false;
}
$view =
"page/components/{$vars['list_type']}";
$view =
'page/components/list';
}
}
'items' => $annotations,
'offset' => null,
'limit' => null,
'list_class' => 'elgg-list-annotation',
'full_view' => true,
'list_type' => $list_type,
'offset_key' => 'annoff',
];
$vars[
'pagination'] =
false;
}
$view =
"page/components/{$vars['list_type']}";
$view =
'page/components/list';
}
}
'items' => $relationships,
'offset' => null,
'limit' => null,
'list_class' => 'elgg-list-relationship',
'full_view' => false,
'list_type' => $list_type,
'offset_key' => 'reloff',
];
$vars[
'pagination'] =
false;
}
$view =
"page/components/{$vars['list_type']}";
$view =
'page/components/list';
}
}
'full_view' => true,
];
return '';
}
$relationship_views = [
"relationship/{$name}",
'relationship/default',
];
foreach ($relationship_views as
$view) {
}
}
return '';
}
}
$view =
'output/friendlytime';
];
}
if (!
$entity->hasCapability(
'commentable')) {
return '';
}
$vars[
'show_add_form'] = $add_comment;
$default_id = 'comments';
$default_id .= "-{$entity->guid}";
}
}
}
}
}
}
return '';
}
}
$river_views = [
'river/item',
"river/{$type}/{$subtype}/{$action}",
"river/{$type}/{$subtype}/default",
"river/{$type}/{$action}",
"river/{$type}/default",
'river/elements/layout',
];
foreach ($river_views as
$view) {
}
}
return '';
}
}
}
}
$prefixes = ['#'];
}
$return = [];
$default_section = '';
foreach ($prefixes as $prefix) {
if (substr(
$key, 0, 1) === $prefix) {
break;
} else {
}
}
}
return $return;
}
}
_elgg_services()->logger->error(__FUNCTION__ .
'(): $params["#type"] is required.');
return '';
}
return '';
}
$hidden_types = ['hidden', 'securitytoken'];
}
$params[
'id'] =
'elgg-field-' . base_convert(mt_rand(), 10, 36);
}
$make_special_checkbox_label = false;
} else {
$make_special_checkbox_label = true;
}
}
];
$element_vars = array_merge($split_params[''], $split_params['#']);
$label_vars = $element_vars;
unset($label_vars['id']);
}
$element_vars[
'label'] =
elgg_view(
'elements/forms/label', $label_vars);
$element_vars[
'help'] =
elgg_view(
'elements/forms/help', $element_vars);
if ($make_special_checkbox_label) {
unset($element_vars['label']);
}
return elgg_view(
'elements/forms/field', $element_vars);
}
]);
}
}
}
return '';
}
}
}
}
return false;
}
}
}
_elgg_services()->logger->error(
'"elgg.data" Event handlers must return an array. Returned ' . gettype(
$data) .
'.');
}
if ($message_delay < 1) {
$message_delay = 6;
}
$elgg = [
'config' => [
'simplecache_enabled' => (int)
_elgg_services()->simpleCache->isEnabled(),
'message_delay' => $message_delay * 1000,
],
'security' => [
'interval' => (int)
_elgg_services()->csrf->getActionTokenTimeout() * 333,
'token' => [
],
],
'session' => [
'user' => null,
],
];
$user_object =
$user->toObject();
$user_object->admin =
$user->isAdmin();
$elgg['user'] = (array) $user_object;
}
return $elgg;
}
$current_view_type = null;
}
if (isset($current_view_type)) {
}
return $ret;
}
}
}
}
if(! $user||! $user->canDelete()) $name
if(!empty($avatar) &&! $avatar->isValid()) elseif(empty($avatar)) if(! $owner->saveIconFromUploadedFile('avatar')) if(!elgg_trigger_event('profileiconupdate', $owner->type, $owner)) $view
$params
Saves global plugin settings.
return[ 'admin/delete_admin_notices'=>['access'=> 'admin'], 'admin/menu/save'=>['access'=> 'admin'], 'admin/plugins/activate'=>['access'=> 'admin'], 'admin/plugins/activate_all'=>['access'=> 'admin'], 'admin/plugins/deactivate'=>['access'=> 'admin'], 'admin/plugins/deactivate_all'=>['access'=> 'admin'], 'admin/plugins/set_priority'=>['access'=> 'admin'], 'admin/security/security_txt'=>['access'=> 'admin'], 'admin/security/settings'=>['access'=> 'admin'], 'admin/security/regenerate_site_secret'=>['access'=> 'admin'], 'admin/site/cache/invalidate'=>['access'=> 'admin'], 'admin/site/flush_cache'=>['access'=> 'admin'], 'admin/site/icons'=>['access'=> 'admin'], 'admin/site/set_maintenance_mode'=>['access'=> 'admin'], 'admin/site/set_robots'=>['access'=> 'admin'], 'admin/site/theme'=>['access'=> 'admin'], 'admin/site/unlock_upgrade'=>['access'=> 'admin'], 'admin/site/settings'=>['access'=> 'admin'], 'admin/upgrade'=>['access'=> 'admin'], 'admin/upgrade/reset'=>['access'=> 'admin'], 'admin/user/ban'=>['access'=> 'admin'], 'admin/user/bulk/ban'=>['access'=> 'admin'], 'admin/user/bulk/delete'=>['access'=> 'admin'], 'admin/user/bulk/unban'=>['access'=> 'admin'], 'admin/user/bulk/validate'=>['access'=> 'admin'], 'admin/user/change_email'=>['access'=> 'admin'], 'admin/user/delete'=>['access'=> 'admin'], 'admin/user/login_as'=>['access'=> 'admin'], 'admin/user/logout_as'=>[], 'admin/user/makeadmin'=>['access'=> 'admin'], 'admin/user/resetpassword'=>['access'=> 'admin'], 'admin/user/removeadmin'=>['access'=> 'admin'], 'admin/user/unban'=>['access'=> 'admin'], 'admin/user/validate'=>['access'=> 'admin'], 'annotation/delete'=>[], 'avatar/upload'=>[], 'comment/save'=>[], 'diagnostics/download'=>['access'=> 'admin'], 'entity/chooserestoredestination'=>[], 'entity/delete'=>[], 'entity/mute'=>[], 'entity/restore'=>[], 'entity/subscribe'=>[], 'entity/trash'=>[], 'entity/unmute'=>[], 'entity/unsubscribe'=>[], 'login'=>['access'=> 'logged_out'], 'logout'=>[], 'notifications/mute'=>['access'=> 'public'], 'plugins/settings/remove'=>['access'=> 'admin'], 'plugins/settings/save'=>['access'=> 'admin'], 'plugins/usersettings/save'=>[], 'register'=>['access'=> 'logged_out', 'middleware'=>[\Elgg\Router\Middleware\RegistrationAllowedGatekeeper::class,],], 'river/delete'=>[], 'settings/notifications'=>[], 'settings/notifications/subscriptions'=>[], 'user/changepassword'=>['access'=> 'public'], 'user/requestnewpassword'=>['access'=> 'public'], 'useradd'=>['access'=> 'admin'], 'usersettings/save'=>[], 'widgets/add'=>[], 'widgets/delete'=>[], 'widgets/move'=>[], 'widgets/save'=>[],]
if(empty($plugins)) $errors
if(!elgg_view_exists("plugins/{$plugin_id}/settings")) $form_vars
if(! $annotation instanceof ElggAnnotation) $time
if(! $entity instanceof \ElggUser) $data
elgg_get_simplecache_url(string $view)
Get the URL for the cached view.
if($vars['name'] && $vars['default'] !==false) $input_vars
Thrown when page is not accessible.
Exception thrown if an argument is not of the expected type.
elgg_get_site_url()
Get the URL for the current (or specified) site, ending with "/".
elgg_get_config(string $name, $default=null)
Get an Elgg configuration value.
elgg_get_release()
Get the current Elgg release.
const ELGG_ENTITIES_ANY_VALUE
Constant to request the value of a parameter be ignored in elgg_get_*() functions.
if($who_can_change_language==='nobody') elseif($who_can_change_language==='admin_only' &&!elgg_is_admin_logged_in()) $options
if($email instanceof \Elgg\Email) $object
if($item instanceof \ElggEntity) elseif($item instanceof \ElggRiverItem) elseif($item instanceof \ElggRelationship) elseif(is_callable([ $item, 'getType']))
$relationship
Elgg default relationship view.
elgg_extract_class(array $array, array|string $existing=[], string $extract_key='class')
Extract class names from an array, optionally merging into a preexisting set.
_elgg_services()
Get the global service provider.
elgg_extract($key, $array, $default=null, bool $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
elgg_import_esm(string $name)
Helper functions for external files like css/js.
elgg_load_external_file(string $type, string $name)
Load an external resource for use on this page.
elgg_register_external_file(string $type, string $name, string $url, string $location='')
Core registration function for external files.
elgg_register_esm(string $name, string $href)
Registers an ES module to the import map.
elgg_require_css(string $view)
Register a CSS view name to be included in the HTML head.
elgg_get_current_language()
Get the current system/user language or 'en'.
elgg_is_xhr()
Checks whether the request was requested via ajax.
elgg_trigger_event_results(string $event, string $type, array $params=[], $returnvalue=null)
Triggers an event where it is expected that the mixed return value could be manipulated by event call...
elgg_view_entity_icon(\ElggEntity $entity, string $size='medium', array $vars=[])
View the icon of an entity.
elgg_get_viewtype()
Return the current view type.
elgg_view_relationship(\ElggRelationship $relationship, array $vars=[])
Returns a string of a rendered relationship.
elgg_view_comments(\ElggEntity $entity, bool $add_comment=true, array $vars=[])
Returns rendered comments and a comment form for an entity.
_elgg_has_rss_link()
Should the RSS view of this URL be linked to?
elgg_view_icon(string $name, array $vars=[])
View an icon glyph.
elgg_view_module(string $type, string $title, string $body, array $vars=[])
Wrapper function for the module display pattern.
elgg_get_view_extensions(string $view)
Get the views (and priorities) that extend a view.
elgg_view_tagcloud(array $options=[])
Create a tagcloud for viewing.
elgg_view_exists(string $view, string $viewtype='', bool $recurse=true)
Returns whether the specified view exists.
elgg_unregister_rss_link()
Remove the RSS icon link and link element from the head.
elgg_extend_view(string $view, string $view_extension, int $priority=501)
Extends a view with another view.
elgg_register_ajax_view(string $view)
Register a view to be available for ajax calls.
elgg_view_annotation(\ElggAnnotation $annotation, array $vars=[])
Returns a string of a rendered annotation.
_elgg_get_js_page_data(array $params=[])
Get the initial contents of "elgg" client side.
elgg_unextend_view(string $view, string $view_extension)
Unextends a view.
elgg_view_annotation_list(array $annotations, array $vars=[])
Returns a rendered list of annotations, plus pagination.
elgg_view_field(array $params=[])
Renders a form field, usually with a wrapper element, a label, help text, etc.
elgg_unregister_ajax_view(string $view)
Unregister a view for ajax calls.
elgg_views_boot()
Initialize viewtypes on system boot event This ensures simplecache is cleared during upgrades.
elgg_view_list_item($item, array $vars=[])
View an item in a list.
elgg_set_form_footer(string $footer='')
Sets form footer and defers its rendering until the form view and extensions have been rendered.
elgg_view_entity_url(\ElggEntity $entity, array $options=[])
Helper function for outputting a link to an entity.
elgg_get_form_footer()
Returns currently set footer, or false if not in the form rendering stack.
_elgg_view_under_viewtype(string $view, array $vars, string $viewtype)
Render a view while the global viewtype is temporarily changed.
elgg_view_image_block(string $image, string $body, array $vars=[])
Wrapper function for the image block display pattern.
elgg_view_deprecated(string $view, array $vars, string $suggestion, string $version)
Display a view with a deprecation notice.
elgg_view_river_item(\ElggRiverItem $item, array $vars=[])
Renders a human-readable representation of a river item.
elgg_view_message(string $type, string $body, array $vars=[])
Wrapper function for the message display pattern.
_elgg_split_vars(array $vars=[], ?array $prefixes=null)
Split array of vars into subarrays based on property prefixes.
elgg_view_menu($menu, array $vars=[])
Render a menu.
elgg_view_entity(\ElggEntity $entity, array $vars=[])
Returns a string of a rendered entity.
elgg_view_form(string $action, array $form_vars=[], array $body_vars=[])
elgg_view_layout(string $layout_name, array $vars=[])
Displays a layout with optional parameters.
elgg_view_relationship_list(array $relationships, array $vars=[])
Returns a rendered list of relationships, plus pagination.
elgg_view_resource(string $name, array $vars=[])
Render a resource view.
elgg_view_friendly_time($time, $time_updated=null)
Displays a UNIX timestamp in a friendly way.
elgg_register_viewtype_fallback(string $viewtype)
Register a viewtype to fall back to a default view if a view isn't found for that viewtype.
elgg_view_entity_list(array $entities, array $vars=[])
Returns a rendered list of entities with pagination.
elgg_register_rss_link()
Include the RSS icon link and link element in the head.
elgg_view_title(string $title, array $vars=[])
Renders a title.
elgg_view_page(string $title, string|array $body, string $page_shell='default', array $vars=[])
Assembles and outputs a full page.
elgg_set_viewtype(string $viewtype='')
Manually set the viewtype.
elgg_view_url(string $href, ?string $text=null, array $options=[])
Helper function for outputting urls.
elgg_view(string $view, array $vars=[], string $viewtype='')
Return a parsed view.
if(!empty($title) &&!empty($icon_name)) if(!empty($title)) if(!empty($menu)) if(!empty($header)) if(!empty($body)) $contents
if($container instanceof ElggGroup && $container->guid !=elgg_get_page_owner_guid()) $key
if(parse_url(elgg_get_site_url(), PHP_URL_PATH) !=='/') if(file_exists(elgg_get_root_path() . 'robots.txt'))
Set robots.txt.
$ts
CSRF security token view for use with secure forms.
elgg_get_logged_in_user_entity()
Return the current logged in user, or null if no user is logged in.