ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ParagraphStyleSelector Class Reference
+ Collaboration diagram for ParagraphStyleSelector:

Public Member Functions

 __construct (UIWrapper $ui_wrapper, int $style_id)
 
 getStyleSelector (string $a_selected, string $type="par-action", string $action="par.class", string $attr="class")
 Get style selector. More...
 

Static Public Attributes

static string $style_selector_reset = "margin-top:2px; margin-bottom:2px; text-indent:0px; position:static; float:none; width: auto;"
 

Protected Attributes

int $style_id = 0
 
UIWrapper $ui_wrapper
 
ILIAS DI UIServices $ui
 

Detailed Description

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 25 of file class.ParagraphStyleSelector.php.

Constructor & Destructor Documentation

◆ __construct()

ParagraphStyleSelector::__construct ( UIWrapper  $ui_wrapper,
int  $style_id 
)

Definition at line 33 of file class.ParagraphStyleSelector.php.

References $DIC, $style_id, $ui_wrapper, and ILIAS\Repository\ui().

36  {
37  global $DIC;
38 
39  $this->ui = $DIC->ui();
40  $this->ui_wrapper = $ui_wrapper;
41  $this->style_id = $style_id;
42  }
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

Member Function Documentation

◆ getStyleSelector()

ParagraphStyleSelector::getStyleSelector ( string  $a_selected,
string  $type = "par-action",
string  $action = "par.class",
string  $attr = "class" 
)

Get style selector.

Definition at line 47 of file class.ParagraphStyleSelector.php.

References $ui, $ui_wrapper, ilPCParagraphGUI\_getCharacteristics(), and ILIAS\COPage\Editor\Server\UIWrapper\getButton().

52  : Dropdown {
53  $a_chars = \ilPCParagraphGUI::_getCharacteristics($this->style_id);
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  }
getButton(string $content, string $type, string $action, ?array $data=null, string $component="", bool $primary=false, string $aria_label="")
This describes commonalities between all types of Dropdowns.
Definition: Dropdown.php:34
static _getCharacteristics(int $a_style_id)
Get characteristics.
+ Here is the call graph for this function:

Field Documentation

◆ $style_id

int ParagraphStyleSelector::$style_id = 0
protected

Definition at line 28 of file class.ParagraphStyleSelector.php.

Referenced by __construct().

◆ $style_selector_reset

string ParagraphStyleSelector::$style_selector_reset = "margin-top:2px; margin-bottom:2px; text-indent:0px; position:static; float:none; width: auto;"
static

Definition at line 27 of file class.ParagraphStyleSelector.php.

◆ $ui

ILIAS DI UIServices ParagraphStyleSelector::$ui
protected

Definition at line 31 of file class.ParagraphStyleSelector.php.

Referenced by getStyleSelector().

◆ $ui_wrapper

UIWrapper ParagraphStyleSelector::$ui_wrapper
protected

Definition at line 30 of file class.ParagraphStyleSelector.php.

Referenced by __construct(), and getStyleSelector().


The documentation for this class was generated from the following file: