Commit cedb98f7 authored by Carsten  Rose's avatar Carsten Rose
Browse files

#4015: fillStoreVar - firstImplementation

parent 26103a39
......@@ -1216,7 +1216,7 @@ This store is handy to compare new and old values of a form.
+------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
| Name | Explanation |
+========================+==================================================================================================================================================+
| <column name> | Name of a column of the primary table (as defined in the current form). To get, exactly and only, the specified form *FormElement*: *{{pId:R}}* |
| <column name> | Name of a column of the primary table (as defined in the current form). To get, exactly and only, the specified form *FormElement*: *{{pId:B}}* |
+------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
.. _STORE_CLIENT:
......
......@@ -565,6 +565,10 @@ abstract class AbstractBuildForm {
$formElement = $this->evaluate->parseArray($fe, $skip, $debugStack);
$formElement = HelperFormElement::setLanguage($formElement, $parameterLanguageFieldName);
if (isset($formElement[FE_FILL_STORE_VAR])) {
$this->store->appendToStore(STORE_VAR, $formElement[FE_FILL_STORE_VAR]);
}
// Some Defaults
$formElement = Support::setFeDefaults($formElement, $this->formSpec);
......
......@@ -911,6 +911,7 @@ const FE_TYPEAHEAD_LDAP_SEARCH = F_TYPEAHEAD_LDAP_SEARCH;
const FE_TYPEAHEAD_LDAP_SEARCH_PREFETCH = F_TYPEAHEAD_LDAP_SEARCH_PREFETCH;
const FE_TYPEAHEAD_LDAP_SEARCH_PER_TOKEN = F_TYPEAHEAD_LDAP_SEARCH_PER_TOKEN;
const FE_FILL_STORE_LDAP = 'fillStoreLdap';
const FE_FILL_STORE_VAR = 'fillStoreVar';
const FE_CHARACTER_COUNT_WRAP = 'characterCountWrap';
const FE_INPUT_EXTRA_BUTTON_LOCK = 'extraButtonLock';
const FE_INPUT_EXTRA_BUTTON_PASSWORD = 'extraButtonPassword';
......
......@@ -88,6 +88,10 @@ class FormAction {
continue;
}
if (isset($feSpecAction[FE_FILL_STORE_VAR])) {
$this->store->appendToStore(STORE_VAR, $feSpecAction[FE_FILL_STORE_VAR]);
}
// Process templateGroup action elements
if (isset($fe[FE_ID_CONTAINER]) && $fe[FE_ID_CONTAINER] > 0) {
// Get native 'templateGroup'-FE - to retrieve MAX_LENGTH
......
......@@ -836,6 +836,32 @@ class Store {
}
}
}
/**
* Append an array or the first row of array of arrays to store $storeName.
* Existing values will be overwritten.
*
* @param $storeName
* @param array $values
* @throws CodeException
* @throws UserFormException
*/
public static function appendToStore($storeName, array $values) {
if (is_array($values[0])) {
$append = $values[0];
} else {
$append = $values;
}
if (empty($append)) {
return;
}
$store = Store::getInstance();
$store->setStore(array_merge($store->getStore($storeName), $append), $storeName, true);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment