[TASK] RTE: Move modules to Modules directory
[Packages/TYPO3.CMS.git] / typo3 / sysext / rtehtmlarea / Classes / Extension / UserElements.php
1 <?php
2 namespace TYPO3\CMS\Rtehtmlarea\Extension;
3
4 /**
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16 use TYPO3\CMS\Backend\Utility\BackendUtility;
17 use TYPO3\CMS\Core\Utility\GeneralUtility;
18
19 /**
20 * User Elements extension for htmlArea RTE
21 *
22 * @author Stanislas Rolland <typo3(arobas)sjbr.ca>
23 */
24 class UserElements extends \TYPO3\CMS\Rtehtmlarea\RteHtmlAreaApi {
25
26 protected $extensionKey = 'rtehtmlarea';
27
28 // The key of the extension that is extending htmlArea RTE
29 protected $pluginName = 'UserElements';
30
31 // The name of the plugin registered by the extension
32 protected $relativePathToLocallangFile = '';
33
34 // Path to this main locallang file of the extension relative to the extension dir.
35 protected $relativePathToSkin = 'extensions/UserElements/skin/htmlarea.css';
36
37 // Path to the skin (css) file relative to the extension dir
38 protected $htmlAreaRTE;
39
40 // Reference to the invoking object
41 protected $thisConfig;
42
43 // Reference to RTE PageTSConfig
44 protected $toolbar;
45
46 // Reference to RTE toolbar array
47 protected $LOCAL_LANG;
48
49 // Frontend language array
50 protected $pluginButtons = 'user';
51
52 protected $convertToolbarForHtmlAreaArray = array(
53 'user' => 'UserElements'
54 );
55
56 /**
57 * Return JS configuration of the htmlArea plugins registered by the extension
58 *
59 * @param int Relative id of the RTE editing area in the form
60 * @return string JS configuration for registered plugins, in this case, JS configuration of block elements
61 */
62 public function buildJavascriptConfiguration($RTEcounter) {
63 $registerRTEinJavascriptString = '';
64 $button = 'user';
65 if (in_array($button, $this->toolbar)) {
66 if (!is_array($this->thisConfig['buttons.']) || !is_array($this->thisConfig['buttons.'][($button . '.')])) {
67 $registerRTEinJavascriptString .= '
68 RTEarea[' . $RTEcounter . '].buttons.' . $button . ' = new Object();';
69 }
70 $registerRTEinJavascriptString .= '
71 RTEarea[' . $RTEcounter . '].buttons.' . $button . '.pathUserModule = ' .
72 GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('rtehtmlarea_wizard_user_elements')) . ';';
73 }
74 return $registerRTEinJavascriptString;
75 }
76
77 }