2 namespace TYPO3\CMS\Rtehtmlarea\Extension;
37 protected $pluginButtons =
'formatblock, indent, outdent, blockquote, insertparagraphbefore, insertparagraphafter, left, center, right, justifyfull, orderedlist, unorderedlist, line';
45 'formatblock' =>
'FormatBlock',
47 'outdent' =>
'Outdent',
48 'blockquote' =>
'Blockquote',
49 'insertparagraphbefore' =>
'InsertParagraphBefore',
50 'insertparagraphafter' =>
'InsertParagraphAfter',
51 'left' =>
'JustifyLeft',
52 'center' =>
'JustifyCenter',
53 'right' =>
'JustifyRight',
54 'justifyfull' =>
'JustifyFull',
55 'orderedlist' =>
'InsertOrderedList',
56 'unorderedlist' =>
'InsertUnorderedList',
57 'line' =>
'InsertHorizontalRule'
74 'pre' =>
'Preformatted',
75 'address' =>
'Address',
76 'article' =>
'Article',
78 'blockquote' =>
'Long quotation',
82 'nav' =>
'Navigation',
83 'section' =>
'Section'
91 protected $defaultBlockElementsOrder =
'none, p, h1, h2, h3, h4, h5, h6, pre, address, article, aside, blockquote, div, footer, header, nav, section';
101 if (in_array(
'formatblock', $this->toolbar)) {
102 if (!is_array($this->configuration[
'thisConfig'][
'buttons.']) || !is_array($this->configuration[
'thisConfig'][
'buttons.'][
'formatblock.'])) {
103 $jsArray[] =
'RTEarea[editornumber].buttons.formatblock = new Object();';
106 $hideItems = array();
108 $restrictTo = array(
'*');
110 $prefixLabelWithTag =
false;
111 $postfixLabelWithTag =
false;
113 if (is_array($this->configuration[
'thisConfig'][
'buttons.']) && is_array($this->configuration[
'thisConfig'][
'buttons.'][
'formatblock.'])) {
115 if ($this->configuration[
'thisConfig'][
'buttons.'][
'formatblock.'][
'removeItems']) {
119 if ($this->configuration[
'thisConfig'][
'buttons.'][
'formatblock.'][
'addItems']) {
123 if ($this->configuration[
'thisConfig'][
'buttons.'][
'formatblock.'][
'restrictToItems']) {
127 if ($this->configuration[
'thisConfig'][
'buttons.'][
'formatblock.'][
'orderItems']) {
128 $blockElementsOrder =
'none,' .
GeneralUtility::strtolower($this->configuration[
'thisConfig'][
'buttons.'][
'formatblock.'][
'orderItems']);
130 $prefixLabelWithTag = $this->configuration[
'thisConfig'][
'buttons.'][
'formatblock.'][
'prefixLabelWithTag'] ?
true : $prefixLabelWithTag;
131 $postfixLabelWithTag = $this->configuration[
'thisConfig'][
'buttons.'][
'formatblock.'][
'postfixLabelWithTag'] ?
true : $postfixLabelWithTag;
136 if (in_array(
'indent', $this->toolbar) || in_array(
'outdent', $this->toolbar)) {
137 $blockElementsOrder = array_merge($blockElementsOrder, array(
'div'));
140 if (in_array(
'blockquote', $this->toolbar)) {
141 $blockElementsOrder = array_merge($blockElementsOrder, array(
'blockquote'));
144 $blockElementsOrder = array_diff($blockElementsOrder, $hideItems);
146 if (!in_array(
'*', $restrictTo)) {
147 $blockElementsOrder = array_intersect($blockElementsOrder, $restrictTo);
150 $blockElementsOptions = array();
152 if (is_array($this->configuration[
'thisConfig'][
'buttons.']) && is_array($this->configuration[
'thisConfig'][
'buttons.'][
'formatblock.']) && is_array($this->configuration[
'thisConfig'][
'buttons.'][
'formatblock.'][
'items.'])) {
153 $labels = $this->configuration[
'thisConfig'][
'buttons.'][
'formatblock.'][
'items.'];
155 foreach ($blockElementsOrder as $item) {
157 'LLL:EXT:rtehtmlarea/Resources/Private/Language/Plugins/BlockElements/locallang.xlf:' . $this->defaultBlockElements[$item]
160 if (is_array($labels[$item .
'.']) && $labels[$item .
'.'][
'label']) {
161 $blockElementsOptions[$item] = $this->
getPageConfigLabel($labels[$item .
'.'][
'label']);
163 $blockElementsOptions[$item] = ($prefixLabelWithTag && $item !=
'none' ? $item .
' - ' :
'') . $blockElementsOptions[$item] . ($postfixLabelWithTag && $item !=
'none' ?
' - ' . $item :
'');
165 $first = array_shift($blockElementsOptions);
167 if (!is_array($this->configuration[
'thisConfig'][
'buttons.']) || !is_array($this->configuration[
'thisConfig'][
'buttons.'][
'formatblock.']) || !$this->configuration[
'thisConfig'][
'buttons.'][
'formatblock.'][
'orderItems']) {
168 asort($blockElementsOptions);
171 $JSBlockElements = array();
172 $JSBlockElements[] = array($first,
'none');
173 foreach ($blockElementsOptions as $item => $label) {
174 $JSBlockElements[] = array($label, $item);
176 $jsArray[] =
'RTEarea[editornumber].buttons.formatblock.options = ' . json_encode($JSBlockElements) .
';';
178 return implode(LF, $jsArray);