aboutsummaryrefslogtreecommitdiff
path: root/views/default/widgets/river_widget/edit.php
blob: 228212e47169e4e2f3856aba36d816e012a2a4f5 (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
47
48
49
50
51
52
53
54
55
56
57
58
<?php
/**
 * Edit settings for river widget
 */

// dashboard widget has type parameter
if (elgg_in_context('dashboard')) {
	if (!isset($vars['entity']->content_type)) {
		$vars['entity']->content_type = 'friends';
	}
	$params = array(
		'name' => 'params[content_type]',
		'value' => $vars['entity']->content_type,
		'options_values' => array(
			'friends' => elgg_echo('river:widgets:friends'),
			'all' => elgg_echo('river:widgets:all'),
		),
	);
	$type_dropdown = elgg_view('input/dropdown', $params);
	?>
	<div>
		<?php echo elgg_echo('river:widget:type'); ?>:
		<?php echo $type_dropdown; ?>
	</div>
	<?php
}


// set default value for number to display
if (!isset($vars['entity']->num_display)) {
	$vars['entity']->num_display = 8;
}

$params = array(
	'name' => 'params[num_display]',
	'value' => $vars['entity']->num_display,
	'options' => array(5, 8, 10, 12, 15, 20),
);
$num_dropdown = elgg_view('input/dropdown', $params);

?>
<div>
	<?php echo elgg_echo('widget:numbertodisplay'); ?>:
	<?php echo $num_dropdown; ?>
</div>

<?php
// pass the context so we have the correct output upon save.
if (elgg_in_context('dashboard')) {
	$context = 'dashboard';
} else {
	$context = 'profile';
}

echo elgg_view('input/hidden', array(
	'name' => 'context',
	'value' => $context
));