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'));
$page_owner_guid
Definition: add.php:9
$show_access
Definition: add.php:12
$column
Definition: add.php:13
$default_widgets
Definition: add.php:14
$handler
Definition: add.php:10
$context
Definition: add.php:11
$page_owner
Definition: add.php:25
$guid
Removes an admin notice.
register_error($error)
Display an error on next page load.
Definition: elgglib.php:455
const REFERER
Definition: elgglib.php:1995
forward($location="", $reason='system')
Forward to $location.
Definition: elgglib.php:80
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
elgg_create_widget($owner_guid, $handler, $context, $access_id=null)
Create a new widget instance.
Definition: widgets.php:38
elgg_can_edit_widget_layout($context, $user_guid=0)
Can the user edit the widget layout.
Definition: widgets.php:53
get_entity($guid)
Loads and returns an entity object from a guid.
Definition: entities.php:382
get_input($variable, $default=null, $filter_result=true)
Get some input from variables passed submitted through GET or POST.
Definition: input.php:27
elgg_get_page_owner_entity()
Gets the owner entity for the current page.
Definition: pageowner.php:53
elgg_set_page_owner_guid($guid)
Set the guid of the entity that owns this page.
Definition: pageowner.php:73
elgg_push_context($context)
Push a context onto the top of the stack.
Definition: pageowner.php:224
elgg_view_entity(\ElggEntity $entity, $vars=array(), $bypass=false, $debug=false)
Returns a string of a rendered entity.
Definition: views.php:793
$widget
Definition: delete.php:9