ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.MediaObjectStyleSelector.php
Go to the documentation of this file.
1<?php
2
21
26{
27 public static string $style_selector_reset = "margin-top:2px; margin-bottom:2px; text-indent:0px; position:static; float:none; width: auto;";
28 protected int $style_id = 0;
29
31 protected \ILIAS\DI\UIServices $ui;
32 protected \ilLanguage $lng;
33
34 public function __construct(
36 int $style_id
37 ) {
38 global $DIC;
39
40 $this->ui = $DIC->ui();
41 $this->ui_wrapper = $ui_wrapper;
42 $this->style_id = $style_id;
43 $this->lng = $DIC->language();
44 }
45
46 public function getStyleSelector(
47 string $a_selected,
48 string $type = "media-action",
49 string $action = "media.class",
50 string $attr = "class"
51 ): Dropdown {
52 $a_chars = \ilPCMediaObjectGUI::_getCharacteristics($this->style_id);
54 $ui = $this->ui;
55
56 $buttons = [];
57 foreach ($a_chars as $char => $char_lang) {
58 $buttons[] = $ui_wrapper->getButton($char_lang, $type, $action, [$attr => $char]);
59 }
60 return $ui->factory()->dropdown()->standard($buttons)->withLabel($a_selected);
61 }
62}
getButton(string $content, string $type, string $action, ?array $data=null, string $component="", bool $primary=false, string $aria_label="")
getStyleSelector(string $a_selected, string $type="media-action", string $action="media.class", string $attr="class")
__construct(UIWrapper $ui_wrapper, int $style_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This describes commonalities between all types of Dropdowns.
Definition: Dropdown.php:35
global $DIC
Definition: shib_login.php:26