TYPO3 CMS  TYPO3_8-7
TYPO3\CMS\T3editor\T3editor Class Reference
Inheritance diagram for TYPO3\CMS\T3editor\T3editor:
TYPO3\CMS\Core\SingletonInterface

Public Member Functions

 setMode ($mode)
 
 setAjaxSaveType ($ajaxSaveType)
 
 setModeByFile ($file)
 
 setModeByType ($type)
 
 getMode ()
 
 __construct ()
 
 getCodeEditor ($name, $class='', $content='', $additionalParams='', $alt='', array $hiddenfields=[])
 
 getPlugins (ServerRequestInterface $request, ResponseInterface $response)
 

Public Attributes

const MODE_TYPOSCRIPT = 'typoscript'
 
const MODE_JAVASCRIPT = 'javascript'
 
const MODE_CSS = 'css'
 
const MODE_XML = 'xml'
 
const MODE_HTML = 'html'
 
const MODE_PHP = 'php'
 
const MODE_SPARQL = 'sparql'
 
const MODE_MIXED = 'mixed'
 

Protected Member Functions

 getPreparedTemplate ()
 
 getParserfileByMode ($mode)
 
 getStylesheetByMode ($mode)
 
 getPageRenderer ()
 

Protected Attributes

 $mode = ''
 
 $ajaxSaveType = ''
 
 $editorCounter = 0
 
 $extPath = ''
 
 $codemirrorPath = 'Resources/Public/JavaScript/Contrib/codemirror/js/'
 
 $codeCompletionComponents = ['TsRef', 'CompletionResult', 'TsParser', 'TsCodeCompletion']
 

Detailed Description

Provides a javascript-driven code editor with syntax highlighting for TS, HTML, CSS and more

Definition at line 28 of file T3editor.php.

Constructor & Destructor Documentation

◆ __construct()

Member Function Documentation

◆ getCodeEditor()

TYPO3\CMS\T3editor\T3editor::getCodeEditor (   $name,
  $class = '',
  $content = '',
  $additionalParams = '',
  $alt = '',
array  $hiddenfields = [] 
)

Generates HTML with code editor

Parameters
string$nameName attribute of HTML tag
string$classClass attribute of HTML tag
string$contentContent of the editor
string$additionalParamsAny additional editor parameters
string$altAlt attribute
array$hiddenfields
Returns
string Generated HTML code for editor

Definition at line 299 of file T3editor.php.

References $GLOBALS, TYPO3\CMS\Core\Utility\GeneralUtility\callUserFunction(), TYPO3\CMS\T3editor\T3editor\getParserfileByMode(), TYPO3\CMS\T3editor\T3editor\getPreparedTemplate(), TYPO3\CMS\T3editor\T3editor\getStylesheetByMode(), and TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

◆ getMode()

TYPO3\CMS\T3editor\T3editor::getMode ( )

Get mode

Returns
string

Definition at line 158 of file T3editor.php.

References TYPO3\CMS\T3editor\T3editor\$mode.

◆ getPageRenderer()

TYPO3\CMS\T3editor\T3editor::getPageRenderer ( )
protected
Returns
PageRenderer

Definition at line 397 of file T3editor.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

Referenced by TYPO3\CMS\T3editor\T3editor\__construct().

◆ getParserfileByMode()

TYPO3\CMS\T3editor\T3editor::getParserfileByMode (   $mode)
protected

Determine the correct parser js file for given mode

Parameters
string$mode
Returns
string Parser file name

Definition at line 216 of file T3editor.php.

References TYPO3\CMS\T3editor\T3editor\$mode.

Referenced by TYPO3\CMS\T3editor\T3editor\getCodeEditor().

◆ getPlugins()

TYPO3\CMS\T3editor\T3editor::getPlugins ( ServerRequestInterface  $request,
ResponseInterface  $response 
)

Gets plugins that are defined at $TYPO3_CONF_VARS['EXTCONF']['t3editor']['plugins'] Called by AjaxRequestHandler

Parameters
ServerRequestInterface$request
ResponseInterface$response
Returns
ResponseInterface

Definition at line 383 of file T3editor.php.

References $GLOBALS.

◆ getPreparedTemplate()

TYPO3\CMS\T3editor\T3editor::getPreparedTemplate ( )
protected

Get the template code, prepared for javascript (no line breaks, quoted in single quotes)

Returns
string The template code, prepared to use in javascript

Definition at line 202 of file T3editor.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\getFileAbsFileName().

Referenced by TYPO3\CMS\T3editor\T3editor\getCodeEditor().

◆ getStylesheetByMode()

TYPO3\CMS\T3editor\T3editor::getStylesheetByMode (   $mode)
protected

Determine the correct css file for given mode

Parameters
string$mode
Returns
string css file name

Definition at line 254 of file T3editor.php.

References TYPO3\CMS\T3editor\T3editor\$mode.

Referenced by TYPO3\CMS\T3editor\T3editor\getCodeEditor().

◆ setAjaxSaveType()

TYPO3\CMS\T3editor\T3editor::setAjaxSaveType (   $ajaxSaveType)

Set the AJAX save type

Parameters
string$ajaxSaveType
Returns

Definition at line 95 of file T3editor.php.

References TYPO3\CMS\T3editor\T3editor\$ajaxSaveType.

◆ setMode()

TYPO3\CMS\T3editor\T3editor::setMode (   $mode)

sets the type of code to edit (::MODE_TYPOSCRIPT, ::MODE_JAVASCRIPT)

Parameters
$modestring Expects one of the predefined constants
Returns

Definition at line 83 of file T3editor.php.

References TYPO3\CMS\T3editor\T3editor\$mode.

Referenced by TYPO3\CMS\T3editor\T3editor\setModeByType().

◆ setModeByFile()

TYPO3\CMS\T3editor\T3editor::setModeByFile (   $file)

Set mode by file

Parameters
string$file

Definition at line 106 of file T3editor.php.

References TYPO3\CMS\T3editor\T3editor\setModeByType(), and TYPO3\CMS\Core\Utility\GeneralUtility\split_fileref().

◆ setModeByType()

TYPO3\CMS\T3editor\T3editor::setModeByType (   $type)

Set mode by type

Parameters
string$type

Definition at line 117 of file T3editor.php.

References TYPO3\CMS\T3editor\T3editor\$mode, and TYPO3\CMS\T3editor\T3editor\setMode().

Referenced by TYPO3\CMS\T3editor\T3editor\setModeByFile().

Member Data Documentation

◆ $ajaxSaveType

TYPO3\CMS\T3editor\T3editor::$ajaxSaveType = ''
protected

Definition at line 47 of file T3editor.php.

Referenced by TYPO3\CMS\T3editor\T3editor\setAjaxSaveType().

◆ $codeCompletionComponents

TYPO3\CMS\T3editor\T3editor::$codeCompletionComponents = ['TsRef', 'CompletionResult', 'TsParser', 'TsCodeCompletion']
protected

Definition at line 75 of file T3editor.php.

◆ $codemirrorPath

TYPO3\CMS\T3editor\T3editor::$codemirrorPath = 'Resources/Public/JavaScript/Contrib/codemirror/js/'
protected

Definition at line 68 of file T3editor.php.

Referenced by TYPO3\CMS\T3editor\T3editor\__construct().

◆ $editorCounter

TYPO3\CMS\T3editor\T3editor::$editorCounter = 0
protected

Definition at line 54 of file T3editor.php.

◆ $extPath

TYPO3\CMS\T3editor\T3editor::$extPath = ''
protected

Definition at line 61 of file T3editor.php.

◆ $mode

◆ MODE_CSS

const TYPO3\CMS\T3editor\T3editor::MODE_CSS = 'css'

Definition at line 32 of file T3editor.php.

◆ MODE_HTML

const TYPO3\CMS\T3editor\T3editor::MODE_HTML = 'html'

Definition at line 34 of file T3editor.php.

◆ MODE_JAVASCRIPT

const TYPO3\CMS\T3editor\T3editor::MODE_JAVASCRIPT = 'javascript'

Definition at line 31 of file T3editor.php.

◆ MODE_MIXED

const TYPO3\CMS\T3editor\T3editor::MODE_MIXED = 'mixed'

Definition at line 37 of file T3editor.php.

Referenced by TYPO3\CMS\T3editor\Form\Element\T3editorElement\render().

◆ MODE_PHP

const TYPO3\CMS\T3editor\T3editor::MODE_PHP = 'php'

Definition at line 35 of file T3editor.php.

◆ MODE_SPARQL

const TYPO3\CMS\T3editor\T3editor::MODE_SPARQL = 'sparql'

Definition at line 36 of file T3editor.php.

◆ MODE_TYPOSCRIPT

const TYPO3\CMS\T3editor\T3editor::MODE_TYPOSCRIPT = 'typoscript'

◆ MODE_XML

const TYPO3\CMS\T3editor\T3editor::MODE_XML = 'xml'

Definition at line 33 of file T3editor.php.