[CLEANUP] Add missing empty lines after copyright comments II
[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
17 use TYPO3\CMS\Backend\Utility\BackendUtility;
18 use TYPO3\CMS\Core\Utility\GeneralUtility;
19
20 /**
21 * User Elements extension for htmlArea RTE
22 *
23 * @author Stanislas Rolland <typo3(arobas)sjbr.ca>
24 */
25 class UserElements extends \TYPO3\CMS\Rtehtmlarea\RteHtmlAreaApi {
26
27 /**
28 * The key of the extension that is extending htmlArea RTE
29 *
30 * @var string
31 */
32 protected $extensionKey = 'rtehtmlarea';
33
34 /**
35 * The name of the plugin registered by the extension
36 *
37 * @var string
38 */
39 protected $pluginName = 'UserElements';
40
41 /**
42 * Path to this main locallang file of the extension relative to the extension directory
43 *
44 * @var string
45 */
46 protected $relativePathToLocallangFile = '';
47
48 /**
49 * Path to the skin file relative to the extension directory
50 *
51 * @var string
52 */
53 protected $relativePathToSkin = 'Resources/Public/Css/Skin/Plugins/user-elements.css';
54
55 /**
56 * Reference to the invoking object
57 *
58 * @var \TYPO3\CMS\Rtehtmlarea\RteHtmlAreaBase
59 */
60 protected $htmlAreaRTE;
61
62 protected $thisConfig;
63
64 // Reference to RTE PageTSConfig
65 protected $toolbar;
66
67 // Reference to RTE toolbar array
68 protected $LOCAL_LANG;
69
70 // Frontend language array
71 protected $pluginButtons = 'user';
72
73 protected $convertToolbarForHtmlAreaArray = array(
74 'user' => 'UserElements'
75 );
76
77 /**
78 * Return JS configuration of the htmlArea plugins registered by the extension
79 *
80 * @param int Relative id of the RTE editing area in the form
81 * @return string JS configuration for registered plugins, in this case, JS configuration of block elements
82 */
83 public function buildJavascriptConfiguration($RTEcounter) {
84 $registerRTEinJavascriptString = '';
85 $button = 'user';
86 if (in_array($button, $this->toolbar)) {
87 if (!is_array($this->thisConfig['buttons.']) || !is_array($this->thisConfig['buttons.'][($button . '.')])) {
88 $registerRTEinJavascriptString .= '
89 RTEarea[' . $RTEcounter . '].buttons.' . $button . ' = new Object();';
90 }
91 $registerRTEinJavascriptString .= '
92 RTEarea[' . $RTEcounter . '].buttons.' . $button . '.pathUserModule = ' .
93 GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('rtehtmlarea_wizard_user_elements')) . ';';
94 }
95 return $registerRTEinJavascriptString;
96 }
97
98 }