Elgg  Version 1.11
add.php
Go to the documentation of this file.
1 <?php
9 $page_owner_guid = get_input('page_owner_guid');
10 $handler = get_input('handler');
11 $context = get_input('context');
12 $show_access = (bool)get_input('show_access', true);
13 $column = get_input('column', 1);
14 $default_widgets = get_input('default_widgets', 0);
15 
17 
19 if ($default_widgets) {
20  elgg_push_context('default_widgets');
21 }
22 elgg_push_context('widgets');
23 
24 // logged in user must be able to edit the layout to add a widget
28  if ($guid) {
30 
31  // position the widget
32  $widget->move($column, 0);
33 
34  // send widget html for insertion
35  echo elgg_view_entity($widget, array('show_access' => $show_access));
36 
38  }
39 }
40 
41 register_error(elgg_echo('widgets:add:failure'));
$context
Definition: add.php:11
get_input($variable, $default=null, $filter_result=true)
Get some input from variables passed submitted through GET or POST.
Definition: input.php:27
$default_widgets
Definition: add.php:14
$column
Definition: add.php:13
$widget
Definition: delete.php:9
$guid
Removes an admin notice.
elgg forward
Meant to mimic the php forward() function by simply redirecting the user to another page...
Definition: elgglib.js:419
$show_access
Definition: add.php:12
elgg_set_page_owner_guid($guid)
Set the guid of the entity that owns this page.
Definition: pageowner.php:73
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
elgg_can_edit_widget_layout($context, $user_guid=0)
Can the user edit the widget layout.
Definition: widgets.php:53
const REFERER
Definition: elgglib.php:1995
elgg echo
Translates a string.
Definition: languages.js:43
elgg_get_page_owner_entity()
Gets the owner entity for the current page.
Definition: pageowner.php:53
$page_owner
Definition: add.php:25
elgg_push_context($context)
Push a context onto the top of the stack.
Definition: pageowner.php:224
elgg register_error
Wrapper function for system_messages.
Definition: elgglib.js:383
elgg_view_entity(\ElggEntity $entity, $vars=array(), $bypass=false, $debug=false)
Returns a string of a rendered entity.
Definition: views.php:793
$page_owner_guid
Definition: add.php:9
$handler
Definition: add.php:10
elgg_create_widget($owner_guid, $handler, $context, $access_id=null)
Create a new widget instance.
Definition: widgets.php:38
get_entity($guid)
Loads and returns an entity object from a guid.
Definition: entities.php:382