Elgg  Version 2.2
 All Classes Namespaces Files Functions Variables Pages
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
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
$default_widgets
Definition: add.php:14
$column
Definition: add.php:13
$widget
Definition: delete.php:9
$guid
Removes an admin notice.
$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:72
register_error($error)
Display an error on next page load.
Definition: elgglib.php:452
elgg_view_entity(\ElggEntity $entity, array $vars=array(), $bypass=false, $debug=false)
Returns a string of a rendered entity.
Definition: views.php:832
get_input($variable, $default=null, $filter_result=true)
Get some input from variables passed submitted through GET or POST.
Definition: input.php:27
elgg_can_edit_widget_layout($context, $user_guid=0)
Can the user edit the widget layout.
Definition: widgets.php:54
const REFERER
Definition: elgglib.php:2029
elgg_get_page_owner_entity()
Gets the owner entity for the current page.
Definition: pageowner.php:56
$page_owner
Definition: add.php:25
forward($location="", $reason= 'system')
Forward to $location.
Definition: elgglib.php:93
elgg_push_context($context)
Push a context onto the top of the stack.
Definition: pageowner.php:215
$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:39
get_entity($guid)
Loads and returns an entity object from a guid.
Definition: entities.php:204