Elgg  Version master
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 
29  $list_items .= elgg_format_element('li', $options, elgg_view_url('#', $category, ['rel' => $key]));
30 }
31 
33  'class' => ['elgg-admin-plugins-categories', 'elgg-admin-sidebar-menu', 'elgg-menu-hz'],
34 ], $list_items);
35 
36 echo elgg_view_module('', elgg_echo('filter'), $body, [
37  'id' => 'plugins-filter',
38 ]);
elgg_view_module(string $type, string $title, string $body, array $vars=[])
Wrapper function for the module display pattern.
Definition: views.php:940
$categories
Category filter for plugins.
Definition: filter.php:9
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
elgg_strtolower()
Wrapper function for mb_strtolower().
Definition: mb_wrapper.php:161
if(empty($categories)) $input_filter
Definition: filter.php:14
$options
Elgg admin footer.
Definition: footer.php:6
elgg_extract($key, $array, $default=null, bool $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:254
foreach($categories as $key=> $category) $body
Definition: filter.php:32
if($container instanceof ElggGroup &&$container->guid!=elgg_get_page_owner_guid()) $key
Definition: summary.php:44
$vars
Definition: theme.php:5
$list_items
Definition: filter.php:16
elgg_view_url(string $href, string $text=null, array $options=[])
Helper function for outputting urls.
Definition: views.php:1448
elgg_format_element(string $tag_name, array $attributes=[], string $text= '', array $options=[])
Format an HTML element.
Definition: output.php:145