Elgg  Version 2.3
filter.php
Go to the documentation of this file.
1 <?php
8 // create selection array
9 $options = array();
10 $options['type=all'] = elgg_echo('river:select', array(elgg_echo('all')));
11 $registered_entities = elgg_get_config('registered_entities');
12 
13 if (!empty($registered_entities)) {
14  foreach ($registered_entities as $type => $subtypes) {
15  // subtype will always be an array.
16  if (!count($subtypes)) {
17  $label = elgg_echo('river:select', array(elgg_echo("item:$type")));
18  $options["type=$type"] = $label;
19  } else {
20  foreach ($subtypes as $subtype) {
21  $label = elgg_echo('river:select', array(elgg_echo("item:$type:$subtype")));
22  $options["type=$type&subtype=$subtype"] = $label;
23  }
24  }
25  }
26 }
27 
28 $params = array(
29  'id' => 'elgg-river-selector',
30  'options_values' => $options,
31 );
32 $selector = $vars['selector'];
33 if ($selector) {
34  $params['value'] = $selector;
35 }
36 $select = elgg_view('input/select', $params);
37 
39  '#tag_name' => 'label',
40  'class' => 'elgg-river-selector',
41  '#text' => elgg_format_element('span', [], elgg_echo('filter')) . " $select",
42 ]);
43 
44 echo elgg_format_element('div', ['class' => 'clearfix'], $input);
elgg_get_config($name, $site_guid=0)
Get an Elgg configuration value.
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
$input
Definition: filter.php:38
if(!empty($registered_entities)) $params
Definition: filter.php:28
if($selector) $select
Definition: filter.php:36
$subtype
Definition: delete.php:28
$vars['entity']
$registered_entities
Definition: filter.php:11
elgg_format_element($tag_name, array $attributes=array(), $text= '', array $options=array())
Format an HTML element.
Definition: output.php:208
$options
Content filter for river.
Definition: filter.php:9
elgg echo
Translates a string.
Definition: languages.js:48
elgg_view($view, $vars=array(), $ignore1=false, $ignore2=false, $viewtype= '')
Return a parsed view.
Definition: views.php:336
$label
Elgg profile plugin edit default profile action.
Definition: add.php:7
$subtypes
$selector
Definition: filter.php:32
if(!$display_name) $type
Definition: delete.php:27