ILIAS  release_8 Revision v8.24
_Base.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
6
7//Base example, show-casing how this control is used if firing leads to some
8//Reload of the page
9function _Base()
10{
11 //Loading factories
12 global $DIC;
13 $f = $DIC->ui()->factory();
14 $renderer = $DIC->ui()->renderer();
15 $refinery = $DIC->refinery();
16 $request_wrapper = $DIC->http()->wrapper()->query();
17
18 //Initializing the options
19 $options = [
20 'default_option' => 'Default Ordering',
21 'latest' => 'Most Recent Ordering',
22 'oldest' => 'Oldest Ordering'
23 ];
24
25 //Note that the selected option needs to be displayed in the label
26 $select_option = 'default_option';
27 if ($request_wrapper->has('sortation') && $request_wrapper->retrieve('sortation', $refinery->kindlyTo()->string())) {
28 $select_option = $request_wrapper->retrieve('sortation', $refinery->kindlyTo()->string());
29 }
30
31 //Generation of the UI Component
32 $s = $f->viewControl()->sortation($options)
33 ->withTargetURL($DIC->http()->request()->getRequestTarget(), 'sortation')
34 ->withLabel($options[$select_option]);
35
36 //Rendering
37 return $renderer->render($s);
38}
global $DIC
Definition: feed.php:28
Refinery Factory $refinery