ILIAS  release_8 Revision v8.24
class.ParagraphStyleSelector.php
Go to the documentation of this file.
1<?php
2
20
23
28{
29 public static string $style_selector_reset = "margin-top:2px; margin-bottom:2px; text-indent:0px; position:static; float:none; width: auto;";
30 protected int $style_id = 0;
31
33 protected \ILIAS\DI\UIServices $ui;
34
35 public function __construct(
37 int $style_id
38 ) {
39 global $DIC;
40
41 $this->ui = $DIC->ui();
42 $this->ui_wrapper = $ui_wrapper;
43 $this->style_id = $style_id;
44 }
45
49 public function getStyleSelector(
50 string $a_selected,
51 string $type = "par-action",
52 string $action = "par.class",
53 string $attr = "class"
54 ): Dropdown {
55 $a_chars = \ilPCParagraphGUI::_getCharacteristics($this->style_id);
57 $ui = $this->ui;
58 $buttons = [];
59 foreach ($a_chars as $char => $char_lang) {
60 $t = "text_block";
61 $tag = "div";
62 switch ($char) {
63 case "Headline1": $t = "heading1"; $tag = "h1"; break;
64 case "Headline2": $t = "heading2"; $tag = "h2"; break;
65 case "Headline3": $t = "heading3"; $tag = "h3"; break;
66 }
67 $html = '<div class="ilCOPgEditStyleSelectionItem"><' . $tag . ' class="ilc_' . $t . '_' . $char . '" style="' . self::$style_selector_reset . '">' . $char_lang . "</" . $tag . "></div>";
68 $buttons[] = $ui_wrapper->getButton($html, $type, $action, [$attr => $char]);
69 }
70 $dd = $ui->factory()->dropdown()->standard($buttons)->withLabel($a_selected);
71 return $dd;
72 }
73}
getStyleSelector(string $a_selected, string $type="par-action", string $action="par.class", string $attr="class")
Get style selector.
getButton(string $content, string $type, string $action, array $data=null, string $component="", string $aria_label="")
Class ilPCParagraphGUI User Interface for Paragraph Editing.
global $DIC
Definition: feed.php:28
This describes commonalities between all types of Dropdowns.
Definition: Dropdown.php:35
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$type