ILIAS
trunk Revision v11.0_alpha-2638-g80c1d007f79
◀ ilDoc Overview
class.ParagraphStyleSelector.php
Go to the documentation of this file.
1
<?php
2
19
use
ILIAS\COPage\Editor\Server\UIWrapper
;
20
use
ILIAS\UI\Component\Dropdown\Dropdown
;
21
25
class
ParagraphStyleSelector
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
30
protected
UIWrapper
$ui_wrapper
;
31
protected \ILIAS\DI\UIServices
$ui
;
32
33
public
function
__construct
(
34
UIWrapper
$ui_wrapper,
35
int
$style_id
36
) {
37
global
$DIC
;
38
39
$this->
ui
= $DIC->ui();
40
$this->ui_wrapper =
$ui_wrapper
;
41
$this->style_id =
$style_id
;
42
}
43
47
public
function
getStyleSelector
(
48
string
$a_selected,
49
string
$type =
"par-action"
,
50
string
$action =
"par.class"
,
51
string
$attr =
"class"
52
):
Dropdown
{
53
$a_chars =
\ilPCParagraphGUI::_getCharacteristics
($this->style_id);
54
$ui_wrapper =
$this->ui_wrapper
;
55
$ui =
$this->ui
;
56
$buttons = [];
57
foreach
($a_chars as $char => $char_lang) {
58
$t =
"text_block"
;
59
$tag =
"p"
;
60
switch
($char) {
61
case
"Headline1"
: $t =
"heading1"
;
62
$tag =
"h1"
;
63
break
;
64
case
"Headline2"
: $t =
"heading2"
;
65
$tag =
"h2"
;
66
break
;
67
case
"Headline3"
: $t =
"heading3"
;
68
$tag =
"h3"
;
69
break
;
70
}
71
$html =
'<div class="ilCOPgEditStyleSelectionItem"><'
. $tag .
' class="ilc_'
. $t .
'_'
. $char .
'" style="'
. self::$style_selector_reset .
'">'
. $char_lang .
"</"
. $tag .
"></div>"
;
72
$buttons[] = $ui_wrapper->
getButton
($html, $type, $action, [$attr => $char]);
73
}
74
$dd = $ui->factory()->dropdown()->standard($buttons)->withLabel($a_selected);
75
return
$dd;
76
}
77
}
Dropdown
ParagraphStyleSelector\getStyleSelector
getStyleSelector(string $a_selected, string $type="par-action", string $action="par.class", string $attr="class")
Get style selector.
Definition:
class.ParagraphStyleSelector.php:47
ILIAS\COPage\Editor\Server\UIWrapper
Definition:
class.UIWrapper.php:28
UIWrapper
ILIAS\COPage\Editor\Server\UIWrapper\getButton
getButton(string $content, string $type, string $action, ?array $data=null, string $component="", bool $primary=false, string $aria_label="")
Definition:
class.UIWrapper.php:46
ParagraphStyleSelector\$ui
ILIAS DI UIServices $ui
Definition:
class.ParagraphStyleSelector.php:31
ILIAS\UI\Component\Dropdown\Dropdown
This describes commonalities between all types of Dropdowns.
Definition:
Dropdown.php:34
ParagraphStyleSelector\__construct
__construct(UIWrapper $ui_wrapper, int $style_id)
Definition:
class.ParagraphStyleSelector.php:33
ILIAS\Repository\ui
ui()
Definition:
trait.GlobalDICGUIServices.php:53
$DIC
global $DIC
Definition:
shib_login.php:26
ilPCParagraphGUI\_getCharacteristics
static _getCharacteristics(int $a_style_id)
Get characteristics.
Definition:
class.ilPCParagraphGUI.php:79
ParagraphStyleSelector
ParagraphStyleSelector\$ui_wrapper
UIWrapper $ui_wrapper
Definition:
class.ParagraphStyleSelector.php:30
ParagraphStyleSelector\$style_id
int $style_id
Definition:
class.ParagraphStyleSelector.php:28
ParagraphStyleSelector\$style_selector_reset
static string $style_selector_reset
Definition:
class.ParagraphStyleSelector.php:27
components
ILIAS
COPage
PC
Paragraph
class.ParagraphStyleSelector.php
Generated on Sun Aug 31 2025 23:02:41 for ILIAS by
1.8.13 (using
Doxyfile
)