aboutsummaryrefslogtreecommitdiff
path: root/views/default/object/widget/elements/controls.php
blob: a421d4d41803b515a432fe89c64c8b1fa79e0a9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
/**
 * Elgg widget controls
 *
 * @uses $vars['widget']
 * @uses $vars['show_edit'] Whether to show the edit button (true)
 */

$widget = $vars['widget'];
$show_edit = elgg_extract('show_edit', $vars, true);

$params = array(
	'text' => ' ',
	'href' => "#elgg-widget-content-$widget->guid",
	'class' => 'elgg-widget-collapse-button elgg-toggler',
);
$collapse_link = elgg_view('output/url', $params);

$delete_link = $edit_link = '';
if ($widget->canEdit()) {
	$params = array(
		'text' => elgg_view_icon('delete'),
		'title' => elgg_echo('widget:delete', array($widget->getTitle())),
		'href' => "action/widgets/delete?guid=$widget->guid",
		'is_action' => true,
		'class' => 'elgg-widget-delete-button',
		'id' => "elgg-widget-delete-button-$widget->guid"
	);
	$delete_link = elgg_view('output/url', $params);

	if ($show_edit) {
		$params = array(
			'text' => elgg_view_icon('gear'),
			'title' => elgg_echo('widget:edit'),
			'href' => "#widget-edit-$widget->guid",
			'class' => "elgg-toggler elgg-widget-edit-button",
		);
		$edit_link = elgg_view('output/url', $params);
	}
}

echo <<<___END
	$collapse_link
	$delete_link
	$edit_link
___END;