Elgg  Version 2.3
filter.php
Go to the documentation of this file.
1 <?php
8 $categories = elgg_extract('category_options', $vars);
9 if (empty($categories)) {
10  return;
11 }
12 
14 foreach ($categories as $key => $category) {
15  if (empty($key)) {
16  continue;
17  }
18 
19  $key = preg_replace('/[^a-z0-9-]/i', '-', $key);
20  $link = elgg_view('output/url', array(
21  'text' => $category,
22  'href' => '#',
23  'rel' => $key
24  ));
25 
26  $list_items .= elgg_format_element('li', array(), $link);
27 }
28 
30  '#tag_name' => 'ul',
31  'class' => 'elgg-admin-plugins-categories elgg-admin-sidebar-menu elgg-menu-hz',
32  '#text' => $list_items,
33 ]);
34 
35 echo elgg_view_module('', elgg_echo('filter'), $body, [
36  'id' => 'plugins-filter',
37 ]);
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
$categories
Category filter for plugins.
Definition: filter.php:8
$link
Definition: container.php:14
$vars['entity']
elgg_format_element($tag_name, array $attributes=array(), $text= '', array $options=array())
Format an HTML element.
Definition: output.php:208
$key
Definition: summary.php:34
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
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:1375
foreach($categories as $key=> $category) $body
Definition: filter.php:29
elgg_view_module($type, $title, $body, array $vars=array())
Wrapper function for the module display pattern.
Definition: views.php:1250
if(empty($categories)) $list_items
Definition: filter.php:13