ILIAS  release_7 Revision v7.30-3-g800a261c036
class.MediaObjectStyleSelector.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2020 ILIAS open source, Extended GPL, see docs/LICENSE */
4
6
12{
13 public static $style_selector_reset = "margin-top:2px; margin-bottom:2px; text-indent:0px; position:static; float:none; width: auto;";
14
18 protected $ui_wrapper;
19
23 protected $ui;
24
28 protected $lng;
29
33 public function __construct($ui_wrapper, $style_id)
34 {
35 global $DIC;
36
37 $this->ui = $DIC->ui();
38 $this->ui_wrapper = $ui_wrapper;
39 $this->style_id = $style_id;
40 $this->lng = $DIC->language();
41 }
42
46 public function getStyleSelector($a_selected, $type = "media-action", $action = "media.class", $attr = "class")
47 {
48 $a_chars = \ilPCMediaObjectGUI::_getCharacteristics($this->style_id);
50 $ui = $this->ui;
52
53 $buttons = [];
54 foreach ($a_chars as $char => $char_lang) {
55 $buttons[] = $ui_wrapper->getButton($char_lang, $type, $action, [$attr => $char]);
56 }
57 $dd = $ui->factory()->dropdown()->standard($buttons)->withLabel($a_selected);
58 return $dd;
59 }
60}
An exception for terminatinating execution or to throw for unit testing.
getStyleSelector($a_selected, $type="media-action", $action="media.class", $attr="class")
Get style selector.
static _getCharacteristics($a_style_id)
Get characteristics.
global $DIC
Definition: goto.php:24
$type
ui()
Definition: ui.php:5