[BUGFIX] RTE: Removing div from block format select box may not work
authorStanislas Rolland <typo3@sjbr.ca>
Thu, 9 Feb 2012 04:57:49 +0000 (23:57 -0500)
committerStanislas Rolland <typo3@sjbr.ca>
Fri, 10 Feb 2012 02:15:31 +0000 (03:15 +0100)
Problem: RTE.default.buttons.formatblock.removeItems = div is not
honoured when Indent/outdent is configured
Solution: Honour the removal/restriction even when Indent/outdent
is configured.

Change-Id: I13eb3e6e6683b7dc9a1ae47caf9b9bb401f659bf
Fixes: #33457
Releases: 4.5, 4.6, 4.7
Reviewed-on: http://review.typo3.org/8953
Reviewed-by: Stanislas Rolland
Tested-by: Stanislas Rolland
typo3/sysext/rtehtmlarea/extensions/BlockElements/class.tx_rtehtmlarea_blockelements.php

index c66827b..4b3be0c 100644 (file)
@@ -139,11 +139,6 @@ class tx_rtehtmlarea_blockelements extends tx_rtehtmlarea_api {
                        }
                                // Adding custom items
                        $blockElementsOrder = array_merge(t3lib_div::trimExplode(',', $this->htmlAreaRTE->cleanList($blockElementsOrder), 1), $addItems);
-                               // Applying User TSConfig restriction
-                       $blockElementsOrder = array_diff($blockElementsOrder, $hideItems);
-                       if (!in_array('*', $restrictTo)) {
-                               $blockElementsOrder = array_intersect($blockElementsOrder, $restrictTo);
-                       }
                                // Add div element if indent is configured in the toolbar
                        if (in_array('indent', $this->toolbar) || in_array('outdent', $this->toolbar)) {
                                $blockElementsOrder = array_merge($blockElementsOrder, array('div'));
@@ -152,6 +147,12 @@ class tx_rtehtmlarea_blockelements extends tx_rtehtmlarea_api {
                        if (in_array('blockquote', $this->toolbar)) {
                                $blockElementsOrder = array_merge($blockElementsOrder, array('blockquote'));
                        }
+                               // Remove items
+                       $blockElementsOrder = array_diff($blockElementsOrder, $hideItems);
+                               // Applying User TSConfig restriction
+                       if (!in_array('*', $restrictTo)) {
+                               $blockElementsOrder = array_intersect($blockElementsOrder, $restrictTo);
+                       }
                                // Localizing the options
                        $blockElementsOptions = array();
                        $labels = array();