diff --git a/typo3/sysext/form/Classes/Domain/Factory/JsonToTypoScript.php b/typo3/sysext/form/Classes/Domain/Factory/JsonToTypoScript.php
index 0db3bd7..de87d1b 100644
--- a/typo3/sysext/form/Classes/Domain/Factory/JsonToTypoScript.php
+++ b/typo3/sysext/form/Classes/Domain/Factory/JsonToTypoScript.php
@@ -128,7 +128,21 @@ class JsonToTypoScript
$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;
@@ -412,7 +426,23 @@ class JsonToTypoScript
}
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'] = '' . LF . '';
+ }
+ }
+ }
+ }
+ }
}
}
diff --git a/typo3/sysext/form/Classes/Domain/Model/Element.php b/typo3/sysext/form/Classes/Domain/Model/Element.php
index 757793e..8b22322 100644
--- a/typo3/sysext/form/Classes/Domain/Model/Element.php
+++ b/typo3/sysext/form/Classes/Domain/Model/Element.php
@@ -123,6 +123,13 @@ class Element extends AbstractEntity
protected $themeName;
/**
+ * The theme name
+ *
+ * @var string
+ */
+ protected $jsonElementNamespace;
+
+ /**
* Creates an instance.
*/
public function __construct()
@@ -511,4 +518,25 @@ class Element extends AbstractEntity
{
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;
+ }
}
diff --git a/typo3/sysext/form/Classes/Domain/Repository/ContentRepository.php b/typo3/sysext/form/Classes/Domain/Repository/ContentRepository.php
index d6e03e8..eea54c0 100644
--- a/typo3/sysext/form/Classes/Domain/Repository/ContentRepository.php
+++ b/typo3/sysext/form/Classes/Domain/Repository/ContentRepository.php
@@ -109,6 +109,22 @@ class ContentRepository
$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;
diff --git a/typo3/sysext/form/Classes/Utility/TypoScriptToJsonConverter.php b/typo3/sysext/form/Classes/Utility/TypoScriptToJsonConverter.php
index 3c808cb..851bc64 100644
--- a/typo3/sysext/form/Classes/Utility/TypoScriptToJsonConverter.php
+++ b/typo3/sysext/form/Classes/Utility/TypoScriptToJsonConverter.php
@@ -83,11 +83,25 @@ class TypoScriptToJsonConverter
*/
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)) {
@@ -209,4 +223,15 @@ class TypoScriptToJsonConverter
}
}
}
+
+ /**
+ * 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);
+ }
}
diff --git a/typo3/sysext/form/Classes/View/Wizard/WizardView.php b/typo3/sysext/form/Classes/View/Wizard/WizardView.php
index 2a56f42..d42425f 100644
--- a/typo3/sysext/form/Classes/View/Wizard/WizardView.php
+++ b/typo3/sysext/form/Classes/View/Wizard/WizardView.php
@@ -239,6 +239,21 @@ class WizardView
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);
+ }
+ }
+ }
}
/**
@@ -261,6 +276,21 @@ class WizardView
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);
+ }
+ }
+ }
}
/**
@@ -290,6 +320,20 @@ class WizardView
$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']);
}
diff --git a/typo3/sysext/form/Resources/Public/JavaScript/Wizard/Initialize.js b/typo3/sysext/form/Resources/Public/JavaScript/Wizard/Initialize.js
index 676b529..9ccf9fd 100644
--- a/typo3/sysext/form/Resources/Public/JavaScript/Wizard/Initialize.js
+++ b/typo3/sysext/form/Resources/Public/JavaScript/Wizard/Initialize.js
@@ -12,6 +12,12 @@
*
* @return void
*/
+TYPO3.TxForm = {
+ userDefinedElements: [],
+ userDefinedValidators: [],
+ userDefinedFilters: []
+}
+
Ext.onReady(function() {
// Instantiate new viewport
var viewport = new TYPO3.Form.Wizard.Viewport({});
diff --git a/typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Elements/Basic.js b/typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Elements/Basic.js
index 4f2e0fd..5ebfaf2 100644
--- a/typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Elements/Basic.js
+++ b/typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Elements/Basic.js
@@ -160,6 +160,20 @@ TYPO3.Form.Wizard.Viewport.Left.Elements.Basic = Ext.extend(TYPO3.Form.Wizard.Vi
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);
diff --git a/typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Filters.js b/typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Filters.js
index 60a0933..0711763 100644
--- a/typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Filters.js
+++ b/typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Filters.js
@@ -42,6 +42,11 @@ TYPO3.Form.Wizard.Viewport.Left.Options.Forms.Filters = Ext.extend(Ext.Panel, {
* 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.
@@ -195,6 +200,10 @@ TYPO3.Form.Wizard.Viewport.Left.Options.Forms.Filters = Ext.extend(Ext.Panel, {
'trim',
'uppercase'
];
+ for (var i = 0; i < TYPO3.TxForm.userDefinedFilters.length; i++) {
+ var userDefinedFilter = TYPO3.TxForm.userDefinedFilters[i];
+ allowedDefaultFilters.push(userDefinedFilter);
+ }
}
var allowedElementFilters = [];
diff --git a/typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Validation.js b/typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Validation.js
index 11618cf..0e2edfa 100644
--- a/typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Validation.js
+++ b/typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Validation.js
@@ -63,6 +63,11 @@ TYPO3.Form.Wizard.Viewport.Left.Options.Forms.Validation = Ext.extend(Ext.Panel,
* 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.
@@ -225,6 +230,10 @@ TYPO3.Form.Wizard.Viewport.Left.Options.Forms.Validation = Ext.extend(Ext.Panel,
'required',
'uri'
];
+ for (var i = 0; i < TYPO3.TxForm.userDefinedValidators.length; i++) {
+ var userDefinedValidator = TYPO3.TxForm.userDefinedValidators[i];
+ allowedDefaultRules.push(userDefinedValidator);
+ }
}
var allowedElementRules = [];