Project

General

Profile

Feature #72927 » patch.diff

Simon Häsler, 2016-01-25 13:50

View differences:

typo3/sysext/form/Classes/Domain/Factory/JsonToTypoScript.php
$this->getForm($element, $parent, $elementCounter);
break;
default:
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['form']['hooks']['userDefined'])) {
$params = array();
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['form']['hooks']['userDefined'] as $hook) {
$xtypes = \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction(
$hook . '->getXTypes',
$params,
$this
);
foreach($xtypes as $xtype) {
if($element['xtype'] == $xtype) {
$this->getDefaultElementSetup($element, $parent, $elementCounter, $childrenWithParentName);
}
}
}
}
}
}
$elementCounter = $elementCounter + 10;
......
}
break;
default:
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['form']['hooks']['userDefined'])) {
$params = array();
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['form']['hooks']['userDefined'] as $hook) {
$xtypes = \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction(
$hook . '->getXTypes',
$params,
$this
);
foreach ($xtypes as $elementName) {
if ($element['xtype'] == $xtype) {
if ($value === 'back') {
$parent[$elementCounter . '.']['layout'] = '<input />' . LF . '<label />';
}
}
}
}
}
}
}
typo3/sysext/form/Classes/Domain/Model/Element.php
protected $themeName;
/**
* The theme name
*
* @var string
*/
protected $jsonElementNamespace;
/**
* Creates an instance.
*/
public function __construct()
......
{
return $this->themeName;
}
/**
* Sets the jsonelement namespace
*
* @param string $jsonElementNamespace
* @return void
*/
public function setJsonElementNamespace($jsonElementNamespace)
{
$this->jsonElementNamespace = $jsonElementNamespace;
}
/**
* Returns the jsonelement namespace
*
* @return string
*/
public function getJsonElementNamespace()
{
return $this->jsonElementNamespace;
}
}
typo3/sysext/form/Classes/Domain/Repository/ContentRepository.php
$typoscript = $record->getTyposcript();
/** @var $converter \TYPO3\CMS\Form\Utility\TypoScriptToJsonConverter */
$converter = GeneralUtility::makeInstance(\TYPO3\CMS\Form\Utility\TypoScriptToJsonConverter::class);
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['form']['hooks']['userDefined'])) {
$params = array();
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['form']['hooks']['userDefined'] as $hook) {
$elementNames = \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction(
$hook . '->getRegisteredElementNames',
$params,
$this
);
foreach ($elementNames as $elementName) {
$converter -> addRegisteredElementName($elementName);
}
}
}
$json = $converter->convert($typoscript);
}
return $json;
typo3/sysext/form/Classes/Utility/TypoScriptToJsonConverter.php
*/
public function createElement($class, array $arguments = array())
{
$objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
$configurationManager = $objectManager -> get('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager');
$extbaseFrameworkConfiguration = $configurationManager->getConfiguration(
\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT
);
$typoScriptService = GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Service\TypoScriptService::class);
$elementSettings = $typoScriptService -> convertTypoScriptArrayToPlainArray(
$extbaseFrameworkConfiguration['plugin.']['tx_form.']['settings.']['registeredElements.'][strtoupper($class) . '.']
);
$class = strtolower((string)$class);
if (!empty($this->nameMapping[$class])) {
$class = $this->nameMapping[$class];
}
$className = 'TYPO3\\CMS\\Form\\Domain\\Model\Json\\' . ucfirst($class) . 'JsonElement';
if ($elementSettings['jsonElementNamespace'])
$className = $elementSettings['jsonElementNamespace']['value'] . '\\' . ucfirst($class) . 'JsonElement';
else
$className = 'TYPO3\\CMS\\Form\\Domain\\Model\Json\\' . ucfirst($class) . 'JsonElement';
$this->addValidationRules($arguments);
if (!class_exists($className)) {
......
}
}
}
/**
* Add a new elementname to the registered element names
*
* @param string $elementName The name of the element
*/
public function addRegisteredElementName($elementName)
{
if (!in_array($elementName, $this -> registeredElementNames))
$this -> registeredElementNames[] = strtoupper($elementName);
}
}
typo3/sysext/form/Classes/View/Wizard/WizardView.php
foreach ($javascriptFiles as $javascriptFile) {
$this->getPageRenderer()->addJsFile($baseUrl . $javascriptFile, 'text/javascript', $compress, false);
}
// Load JS Files from Hook elements
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['form']['hooks']['userDefined'])) {
$params = array();
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['form']['hooks']['userDefined'] as $hook) {
$javascriptFiles = GeneralUtility::callUserFunction(
$hook . '->loadJavascript',
$params,
$this
);
foreach ($javascriptFiles as $javascriptFile) {
$this->getPageRenderer()->addJsFile($javascriptFile, 'text/javascript', $compress, false);
}
}
}
}
/**
......
foreach ($cssFiles as $cssFile) {
$this->getPageRenderer()->addCssFile($baseUrl . $cssFile, 'stylesheet', 'all', '', $compress, false);
}
// Load CSS Files from Hook elements
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['form']['hooks']['userDefined'])) {
$params = array();
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['form']['hooks']['userDefined'] as $hook) {
$cssFiles = GeneralUtility::callUserFunction(
$hook . '->loadCss',
$params,
$this
);
foreach ($cssFiles as $cssFile) {
$this->getPageRenderer()->addCssFile($cssFile, 'stylesheet', 'all', '', $compress, false);
}
}
}
}
/**
......
$wizardLabels = $this->getLanguageService()->includeLLFile('EXT:form/Resources/Private/Language/locallang_wizard.xlf', false, true);
$controllerLabels = $this->getLanguageService()->includeLLFile('EXT:form/Resources/Private/Language/locallang.xlf', false, true);
\TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($controllerLabels, $wizardLabels);
// Userdefined locallang-files
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['form']['hooks']['userDefined'])) {
$params = array();
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['form']['hooks']['userDefined'] as $hook) {
\TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule(
$controllerLabels,
GeneralUtility::callUserFunction(
$hook . '->loadLocalization',
$params,
$this
)
);
}
}
$this->getPageRenderer()->addInlineLanguageLabelArray($controllerLabels['default']);
}
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Initialize.js
*
* @return void
*/
TYPO3.TxForm = {
userDefinedElements: [],
userDefinedValidators: [],
userDefinedFilters: []
}
Ext.onReady(function() {
// Instantiate new viewport
var viewport = new TYPO3.Form.Wizard.Viewport({});
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Elements/Basic.js
scope: this
});
break;
default:
for (var i = 0; i < TYPO3.TxForm.userDefinedElements.length; i++) {
var userDefinedElement = TYPO3.TxForm.userDefinedElements[i];
if (option == userDefinedElement) {
buttons.push({
text: TYPO3.l10n.localize('basic_' + userDefinedElement),
id: 'basic-' + userDefinedElement,
clickEvent: 'dblclick',
handler: this.onDoubleClick,
iconCls: 'formwizard-left-elements-basic-' + userDefinedElement,
scope: this
});
}
}
}
}, this);
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Filters.js
* Add the form elements to the accordion
*/
initComponent: function() {
for (var i = 0; i < TYPO3.TxForm.userDefinedFilters.length; i++) {
var userDefinedFilter = TYPO3.TxForm.userDefinedFilters[i];
this.validFilters[userDefinedFilter] = true;
}
var filters = this.getFiltersBySettings();
// Adds the specified events to the list of events which this Observable may fire.
......
'trim',
'uppercase'
];
for (var i = 0; i < TYPO3.TxForm.userDefinedFilters.length; i++) {
var userDefinedFilter = TYPO3.TxForm.userDefinedFilters[i];
allowedDefaultFilters.push(userDefinedFilter);
}
}
var allowedElementFilters = [];
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Validation.js
* Add the form elements to the accordion
*/
initComponent: function() {
for (var i = 0; i < TYPO3.TxForm.userDefinedValidators.length; i++) {
var userDefinedValidator = TYPO3.TxForm.userDefinedValidators[i];
this.validRules[userDefinedValidator] = true;
}
var rules = this.getRulesBySettings();
// Adds the specified events to the list of events which this Observable may fire.
......
'required',
'uri'
];
for (var i = 0; i < TYPO3.TxForm.userDefinedValidators.length; i++) {
var userDefinedValidator = TYPO3.TxForm.userDefinedValidators[i];
allowedDefaultRules.push(userDefinedValidator);
}
}
var allowedElementRules = [];
(1-1/2)