Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add compatibility with TYPO3 8.7 #3

Merged
merged 6 commits into from
Apr 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@
/t3lib/
# Ignore temp directory.
/typo3temp/
/nbproject/private/
93 changes: 64 additions & 29 deletions Classes/Hooks/Backend/PreHeaderRender.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,10 @@
*
* This copyright notice MUST APPEAR in all copies of the script!
*
* This script is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
* This script is free software distributed under terms of MIT license.
*
* The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html . A copy of GPL is distributed along with Typo3: typo3_src/LICENSE.txt
*/

/***************************************************************
*
* The MIT License (MIT)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
***************************************************************/

use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;

/**
Expand All @@ -63,15 +37,76 @@ protected function isRightToLeft( $l ) {
* @param array $params
* @param \TYPO3\CMS\Backend\Template\DocumentTemplate $documentTemplate
*/
public function addStyles(&$params, &$documentTemplate){
public function addStyles(&$params, &$documentTemplate){

if( isset( $GLOBALS['BE_USER'] ) &&
$this->isRightToLeft( $GLOBALS['BE_USER']->user['lang'] ) ) {
$backendCssPath = ExtensionManagementUtility::extRelPath('typo3rtl') . 'Resources/Public/Css/Backend/';

$params['pageRenderer']->addCssFile($backendCssPath . 'rtl.css' );
$params['pageRenderer']->addCssFile($backendCssPath . 'element_tceforms.css' );
$params['pageRenderer']->addCssFile($backendCssPath . 'module_web_new_element.css' );
$params['pageRenderer']->addCssFile($backendCssPath . 'htmlarea.css' );

error_log("added");
}
}

/**
*
* @param type $params
* @param \TYPO3\CMS\Core\Page\PageRenderer $documentTemplate
*
*/
public function preStartPage(&$params, &$documentTemplate) {
error_log("typo3rtl: render-preProcess hook");
if( isset( $GLOBALS['BE_USER'] ) && $this->isRightToLeft( $GLOBALS['BE_USER']->uc['lang'] ) ) {

$resourcesPath = ExtensionManagementUtility::extRelPath('typo3rtl') . 'Resources/Public/';

$documentTemplate->addCssFile($resourcesPath . 'Css/Backend/rtl.css');
$documentTemplate->addCssFile($resourcesPath . 'Css/Backend/element_tceforms.css');
$documentTemplate->addCssFile($resourcesPath . 'Css/Backend/module_web_new_element.css');
$documentTemplate->addCssFile($resourcesPath . 'Css/Backend/htmlarea.css');
$documentTemplate->addCssFile($resourcesPath . 'Css/7.6/backend.css');
$documentTemplate->addCssFile($resourcesPath . 'Css/bootstrap-rtl.min.css');


error_log("Added render-preProcess");
}
}


public function preStartPage2(&$params, &$documentTemplate) {
error_log("typo3rtl: render-postTransform");
if( isset( $GLOBALS['BE_USER'] ) && $this->isRightToLeft( $GLOBALS['BE_USER']->uc['lang'] ) ) {

$resourcesPath = ExtensionManagementUtility::extRelPath('typo3rtl') . 'Resources/Public/';

$backendCssPath = $resourcesPath . 'Css/Backend/';

$documentTemplate->addCssFile($backendCssPath . 'htmlarea2.css');

error_log("Added");
}
}


public function preStartPage3(&$params, &$documentTemplate) {
error_log("typo3rtl: render-postProcess");
if( isset( $GLOBALS['BE_USER'] ) && $this->isRightToLeft( $GLOBALS['BE_USER']->uc['lang'] ) ) {

$resourcesPath = ExtensionManagementUtility::extRelPath('typo3rtl') . 'Resources/Public/';

$backendCssPath = $resourcesPath . 'Css/Backend/';

$documentTemplate->addCssFile($backendCssPath . 'htmlarea3.css');

$extraPath = $resourcesPath . 'extjs_rtl/';
$documentTemplate->addCssFile($extraPath . 'css/extjs_rtl.css');
$documentTemplate->addJsFooterFile($extraPath . 'extjs_rtl.js');

error_log("Added");
}
}
}
}
30 changes: 30 additions & 0 deletions Configuration/PageTS/RTE.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Enable RTL and LTR keys

RTE.default.showButtons := addToList(lefttoright)
RTE.default.showButtons := addToList(righttoleft)
RTE.default.showButtons := addToList(language)
RTE.default.buttons.lefttoright.setActiveOnRteOpen = 1
RTE.default.buttons.righttoleft.setActiveOnRteOpen = 1
RTE.default.buttons.language.setActiveOnRteOpen = 1

RTE.default {
contentCSS = typo3conf/ext/typo3rtl/Resources/Public/Css/Backend/rteext.css

# // Allow only buttons which are listed in property "toolbarOrder"
# showButtons (
# formatblock, blockstyle, textstyle, bold, italic, strikethrough, big, small, subscript, superscript,
# orderedlist, unorderedlist, left, center, right, justifyfull, copy, cut, paste,
# undo, redo, removeformat, link, unlink, line, insertparagraphbefore, insertparagraphafter,
# lefttoright, righttoleft, language,
# chMode, table, tableproperties, toggleborders, tablerestyle,
# rowproperties, rowinsertabove, rowinsertunder, rowdelete, rowsplit,
# columnproperties, columninsertbefore, columninsertafter, columndelete, columnsplit,
# cellproperties, cellinsertbefore, cellinsertafter, celldelete, cellsplit, cellmerge
# )
# // Define buttons and order of button that will be shown
}

RTE.default.FE < RTE.default



34 changes: 21 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,41 @@
# typo3rtl

This simple extension aims to provide support for right-to-left (RTL) languages for Typo3 6.2 backend.

The extension only renders pages tree , left menu and work area.

Contributions are welcome. Github: https://github.com/olegsv/typo3rtl


## Supported languages ###
When Backend user uses a Right-To-Left ( RTL ) language, this extension rearranges Backend layout
and stylesheets to better render UI in RTL mode. Supported languages are:

* Hebrew ( he )
* Arabic ( ar )
* Farsi ( fa )
* Urdu ( ur )

The extension also enables text direction buttons and Languages menu in HTML editor.

## Installation

## Supported versions ###
Simply download and enable the extension.

Tested with Typo3 6.2.6, 6.2.12-6.2.15 and PHP 5.5.

For old Typo3 versions ( < 4.4 ) use zor_rtl extension.
## Supported TYPO3 versions ###

v1.0 - suitable for 7.6.x and PHP 7

v0.4 - suitable for 6.2.x and PHP 5.5.

For Typo3 versions before 4.4 use zor_rtl extension.

## Known issues

HTML WYSIWYG editor window is misaligned and scrollbar still at the right.
The extension only renders pages tree, left menu and work area. It does not support rearranging panels from right to left yet.

v1.0: does not fully support IE11 in Internet Explorer mode due.

No support for RTE configuration.
v0.4: HTML WYSIWYG editor window is misaligned and scrollbar still at the right.

## About

For RTL of Bootstrap 3.x the extension uses an excellent [Bootstrap-RTL project](https://github.com/morteza/bootstrap-rtl) by [Morteza Ansarinia] (http://github.com/morteza)

__Author: Oleg Sverdlov__

I would appreciate your responses and contributions. The extension is [available on GitHub] (https://github.com/olegsv/typo3rtl).

Loading