Elgg  Version 4.3
filter.php
Go to the documentation of this file.
1 <?php
9 $categories = elgg_extract('category_options', $vars);
10 if (empty($categories)) {
11  return;
12 }
13 
14 $input_filter = elgg_extract('active_filter', $vars);
15 
17 foreach ($categories as $key => $category) {
18  if (empty($key)) {
19  continue;
20  }
21 
22  $key = preg_replace('/[^a-z0-9-]/i', '-', elgg_strtolower($key));
23 
24  $options = [];
25  if ($key === $input_filter) {
26  $options['class'] = 'elgg-state-selected';
27  }
28  $list_items .= elgg_format_element('li', $options, elgg_view_url('#', $category, ['rel' => $key]));
29 }
30 
32  '#tag_name' => 'ul',
33  'class' => 'elgg-admin-plugins-categories elgg-admin-sidebar-menu elgg-menu-hz',
34  '#text' => $list_items,
35 ]);
36 
37 echo elgg_view_module('', elgg_echo('filter'), $body, [
38  'id' => 'plugins-filter',
39 ]);
$categories
Category filter for plugins.
Definition: filter.php:9
elgg_strtolower()
Wrapper function for mb_strtolower().
Definition: mb_wrapper.php:154
elgg_echo($message_key, array $args=[], $language="")
Elgg language module Functions to manage language and translations.
Definition: languages.php:18
if(empty($categories)) $input_filter
Definition: filter.php:14
$options
Elgg admin footer.
Definition: footer.php:6
elgg_format_element($tag_name, array $attributes=[], $text= '', array $options=[])
Format an HTML element.
Definition: output.php:135
elgg_view_module($type, $title, $body, array $vars=[])
Wrapper function for the module display pattern.
Definition: views.php:944
elgg_extract($key, $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:547
foreach($categories as $key=> $category) $body
Definition: filter.php:31
if($container instanceof ElggGroup &&$container->guid!=elgg_get_page_owner_guid()) $key
Definition: summary.php:44
$list_items
Definition: filter.php:16
elgg_view_url(string $href, string $text=null, array $options=[])
Helper function for outputting urls.
Definition: views.php:1513
elgg echo
Translates a string.
Definition: deprecated.js:530
$vars['head']
Definition: html.php:24