diff --git a/boot.php b/boot.php
index dd03ee15a..f1a5f6d66 100644
--- a/boot.php
+++ b/boot.php
@@ -109,8 +109,8 @@ class_alias('Yakamara\YForm\Choice\View', 'rex_yform_choice_view');
// Manager
-rex_complex_perm::register('yform_manager_table_edit', 'Yakamara\YForm\Manager\Table\Perm\Edit');
-rex_complex_perm::register('yform_manager_table_view', 'Yakamara\YForm\Manager\Table\Perm\View');
+rex_complex_perm::register('yform_manager_table_edit', '\Yakamara\YForm\Manager\Table\Perm\Edit');
+rex_complex_perm::register('yform_manager_table_view', '\Yakamara\YForm\Manager\Table\Perm\View');
if (rex::isBackend() && rex::getUser()) {
rex_extension::register('PACKAGES_INCLUDED', function () {
@@ -181,8 +181,8 @@ class_alias('Yakamara\YForm\Choice\View', 'rex_yform_choice_view');
$this->setProperty('pages', $pages);
}
-rex_extension::register('MEDIA_IS_IN_USE', 'rex_yform_value_be_media::isMediaInUse');
-rex_extension::register('PACKAGES_INCLUDED', 'rex_yform_value_be_link::isArticleInUse');
+rex_extension::register('MEDIA_IS_IN_USE', '\Yakamara\YForm\Value\BackendMedia::isMediaInUse');
+rex_extension::register('PACKAGES_INCLUDED', '\Yakamara\YForm\Value\BackendLink::isArticleInUse');
rex_extension::register('YFORM_SAVED', static function (rex_extension_point $ep) {
if ($ep->getSubject() instanceof Exception) {
diff --git a/fragments/yform/manager/page/list.php b/fragments/yform/manager/page/list.php
index 2b232e5f4..a95095dc0 100644
--- a/fragments/yform/manager/page/list.php
+++ b/fragments/yform/manager/page/list.php
@@ -99,7 +99,7 @@ static function ($params) {
if (isset($params['list']->getParams()['table_name'])) {
$target_table = $params['list']->getParams()['table_name'];
$target_field = $tablefield[0];
- $values = rex_yform_value_be_manager_relation::getListValues($target_table, $target_field);
+ $values = \Yakamara\YForm\Value\BackendManagerRelation::getListValues($target_table, $target_field);
$value = $values[$params['list']->getValue('id')];
}
} else {
@@ -111,7 +111,7 @@ static function ($params) {
$target_table = $fields[$field_name]->getElement('table');
$target_field = $fields[$field_name]->getElement('field');
- $values = rex_yform_value_be_manager_relation::getListValues(
+ $values = \Yakamara\YForm\Value\BackendManagerRelation::getListValues(
$target_table,
$target_field,
);
diff --git a/lib/yform/base_abstract.php b/lib/AbstractBase.php
similarity index 93%
rename from lib/yform/base_abstract.php
rename to lib/AbstractBase.php
index 270c9e1cc..1ccda211c 100644
--- a/lib/yform/base_abstract.php
+++ b/lib/AbstractBase.php
@@ -1,13 +1,8 @@
www.yakamara.de
- */
-
-abstract class rex_yform_base_abstract
+namespace Yakamara\YForm;
+
+abstract class AbstractBase
{
public $id;
public $params = [];
diff --git a/lib/Action/AbstractAction.php b/lib/Action/AbstractAction.php
new file mode 100644
index 000000000..978660bd3
--- /dev/null
+++ b/lib/Action/AbstractAction.php
@@ -0,0 +1,15 @@
+www.yakamara.de
- */
-
-class rex_yform_action_callback extends rex_yform_action_abstract
+namespace Yakamara\YForm\Action;
+
+use function call_user_func;
+use function in_array;
+
+class Callback extends AbstractAction
{
public static $callback_actions = [
'pre',
diff --git a/lib/yform/action/copy_value.php b/lib/Action/CopyValue.php
similarity index 70%
rename from lib/yform/action/copy_value.php
rename to lib/Action/CopyValue.php
index aecd041f1..3b2346c10 100644
--- a/lib/yform/action/copy_value.php
+++ b/lib/Action/CopyValue.php
@@ -1,13 +1,8 @@
www.yakamara.de
- */
+namespace Yakamara\YForm\Action;
-class rex_yform_action_copy_value extends rex_yform_action_abstract
+class CopyValue extends AbstractAction
{
public function executeAction(): void
{
diff --git a/lib/yform/action/create_table.php b/lib/Action/CreateTable.php
similarity index 84%
rename from lib/yform/action/create_table.php
rename to lib/Action/CreateTable.php
index 3412e4bdb..1d0b5670d 100644
--- a/lib/yform/action/create_table.php
+++ b/lib/Action/CreateTable.php
@@ -1,13 +1,12 @@
www.yakamara.de
- */
-
-class rex_yform_action_create_table extends rex_yform_action_abstract
+namespace Yakamara\YForm\Action;
+
+use rex;
+use rex_sql;
+use function in_array;
+
+class CreateTable extends AbstractAction
{
public function executeAction(): void
{
diff --git a/lib/yform/action/db.php b/lib/Action/Db.php
similarity index 79%
rename from lib/yform/action/db.php
rename to lib/Action/Db.php
index 260689593..df6df0471 100644
--- a/lib/yform/action/db.php
+++ b/lib/Action/Db.php
@@ -1,14 +1,16 @@
www.yakamara.de
- */
-class rex_yform_action_db extends rex_yform_action_abstract
+namespace Yakamara\YForm\Action;
+
+use Exception;
+use rex;
+use rex_extension;
+use rex_extension_point;
+use rex_sql;
+use function call_user_func;
+use function count;
+
+class Db extends AbstractAction
{
public function executeAction(): void
{
@@ -68,8 +70,6 @@ public function executeAction(): void
$action = 'insert';
$id = $sql->getLastId();
$this->params['main_id'] = $id;
- /** @deprecated since 3.4.1 use id (lowercase) instead */
- $this->params['value_pool']['email']['ID'] = $id;
$this->params['value_pool']['email']['id'] = $id;
}
} catch (Exception $e) {
@@ -103,22 +103,6 @@ public function executeAction(): void
'yform' => true,
],
));
-
- /**
- * @deprecated since 3.4.1 use EP YFORM_SAVED instead
- */
- rex_extension::registerPoint(new rex_extension_point(
- 'REX_YFORM_SAVED',
- $sql,
- [
- 'form' => $this,
- 'sql' => $sql,
- 'table' => $main_table,
- 'action' => $action,
- 'id' => $this->params['main_id'],
- 'yform' => true,
- ],
- ));
}
}
diff --git a/lib/yform/action/db_query.php b/lib/Action/DbQuery.php
similarity index 85%
rename from lib/yform/action/db_query.php
rename to lib/Action/DbQuery.php
index 8765151b5..652809dc5 100644
--- a/lib/yform/action/db_query.php
+++ b/lib/Action/DbQuery.php
@@ -1,13 +1,11 @@
www.yakamara.de
- */
-
-class rex_yform_action_db_query extends rex_yform_action_abstract
+namespace Yakamara\YForm\Action;
+
+use Exception;
+use rex_sql;
+
+class DbQuery extends AbstractAction
{
public function executeAction(): void
{
diff --git a/lib/yform/action/email.php b/lib/Action/Email.php
similarity index 89%
rename from lib/yform/action/email.php
rename to lib/Action/Email.php
index b848c05af..012bbdb37 100644
--- a/lib/yform/action/email.php
+++ b/lib/Action/Email.php
@@ -1,13 +1,12 @@
www.yakamara.de
- */
+namespace Yakamara\YForm\Action;
-class rex_yform_action_email extends rex_yform_action_abstract
+use rex_mailer;
+
+use function is_array;
+
+class Email extends AbstractAction
{
public function executeAction(): void
{
diff --git a/lib/yform/action/encrypt_value.php b/lib/Action/EncryptValue.php
similarity index 74%
rename from lib/yform/action/encrypt_value.php
rename to lib/Action/EncryptValue.php
index f35081503..2adeb0445 100644
--- a/lib/yform/action/encrypt_value.php
+++ b/lib/Action/EncryptValue.php
@@ -1,20 +1,18 @@
www.yakamara.de
- */
-
-class rex_yform_action_encrypt_value extends rex_yform_action_abstract
+namespace Yakamara\YForm\Action;
+
+use function function_exists;
+use function in_array;
+
+class EncryptValue extends AbstractAction
{
public function executeAction(): void
{
$f = $this->getElement(3); // the function
if (!function_exists($f)) {
$f = 'md5';
- } // default func = md5
+ }
// Labels to get
$l = explode(',', $this->getElement(2));
@@ -28,7 +26,6 @@ public function executeAction(): void
return;
}
- // $this->params["value_pool"]["sql"] = Array for database
$k = '';
foreach ($this->params['value_pool']['sql'] as $key => $value) {
if (in_array($key, $l)) {
diff --git a/lib/yform/action/html.php b/lib/Action/Html.php
similarity index 53%
rename from lib/yform/action/html.php
rename to lib/Action/Html.php
index 7a2975e06..af62ae342 100644
--- a/lib/yform/action/html.php
+++ b/lib/Action/Html.php
@@ -1,13 +1,8 @@
www.yakamara.de
- */
+namespace Yakamara\YForm\Action;
-class rex_yform_action_html extends rex_yform_action_abstract
+class Html extends AbstractAction
{
public function executeAction(): void
{
diff --git a/lib/yform/action/manage_db.php b/lib/Action/ManageDb.php
similarity index 70%
rename from lib/yform/action/manage_db.php
rename to lib/Action/ManageDb.php
index d9c54f5a7..ea88187e3 100644
--- a/lib/yform/action/manage_db.php
+++ b/lib/Action/ManageDb.php
@@ -1,34 +1,16 @@
www.yakamara.de
- */
+namespace Yakamara\YForm\Action;
-class rex_yform_action_manage_db extends rex_yform_action_abstract
+use rex_sql;
+
+class ManageDb extends AbstractAction
{
public function executeAction(): void
{
- // START - Spezialfall "be_em_relation"
- /*
- $be_em_table_field = "";
- if($this->params["value_pool"]["sql"]["type_name"] == "be_em_relation")
- {
- $be_em_table_field = $this->params["value_pool"]["sql"]["f1"];
- $this->params["value_pool"]["sql"]["f1"] = $this->params["value_pool"]["sql"]["f3"]."_".$this->params["value_pool"]["sql"]["f1"];
- }
- */
- // ENDE - Spezialfall
-
- // ********************************* TABLE A
-
- // $this->params["debug"]= TRUE;
$sql = rex_sql::factory();
$sql->setDebug($this->params['debug']);
- $main_table = '';
if ('' != $this->getElement(2)) {
$main_table = $this->getElement(2);
} else {
@@ -76,15 +58,12 @@ public function executeAction(): void
if ('' != $where) {
$sql->setWhere($where);
$sql->update();
- $flag = 'update';
} else {
$sql->insert();
- $flag = 'insert';
$id = $sql->getLastId();
$this->params['value_pool']['email']['ID'] = $id;
$this->params['main_id'] = $id;
- // $this->params["value_pool"]["sql"]["ID"] = $id;
if (0 == $id) {
$this->params['form_show'] = true;
$this->params['hasWarnings'] = true;
diff --git a/lib/yform/action/php.php b/lib/Action/Php.php
similarity index 82%
rename from lib/yform/action/php.php
rename to lib/Action/Php.php
index 8679242b3..8f085f6cf 100644
--- a/lib/yform/action/php.php
+++ b/lib/Action/Php.php
@@ -1,6 +1,8 @@
www.yakamara.de
- */
+namespace Yakamara\YForm\Action;
-class rex_yform_action_readtable extends rex_yform_action_abstract
+use rex_sql;
+
+use function count;
+
+class ReadTable extends AbstractAction
{
public function executeAction(): void
{
diff --git a/lib/yform/action/redirect.php b/lib/Action/Redirect.php
similarity index 86%
rename from lib/yform/action/redirect.php
rename to lib/Action/Redirect.php
index f783f7309..04ca935a2 100644
--- a/lib/yform/action/redirect.php
+++ b/lib/Action/Redirect.php
@@ -1,13 +1,11 @@
www.yakamara.de
- */
-
-class rex_yform_action_redirect extends rex_yform_action_abstract
+namespace Yakamara\YForm\Action;
+
+use function count;
+use function is_array;
+
+class Redirect extends AbstractAction
{
public function executeAction(): void
{
diff --git a/lib/yform/action/showtext.php b/lib/Action/ShowText.php
similarity index 78%
rename from lib/yform/action/showtext.php
rename to lib/Action/ShowText.php
index aa14a313a..a976e05da 100644
--- a/lib/yform/action/showtext.php
+++ b/lib/Action/ShowText.php
@@ -1,13 +1,12 @@
www.yakamara.de
- */
-
-class rex_yform_action_showtext extends rex_yform_action_abstract
+namespace Yakamara\YForm\Action;
+
+use rex_i18n;
+
+use function is_scalar;
+
+class ShowText extends AbstractAction
{
public function executeAction(): void
{
diff --git a/lib/yform/action/tpl2email.php b/lib/Action/Tpl2Email.php
similarity index 74%
rename from lib/yform/action/tpl2email.php
rename to lib/Action/Tpl2Email.php
index 5e2502114..86840c53f 100644
--- a/lib/yform/action/tpl2email.php
+++ b/lib/Action/Tpl2Email.php
@@ -1,18 +1,21 @@
www.yakamara.de
- */
+namespace Yakamara\YForm\Action;
-class rex_yform_action_tpl2email extends rex_yform_action_abstract
+use rex;
+use rex_path;
+use Yakamara\YForm\Email\Template;
+
+use function is_array;
+
+use const FILTER_VALIDATE_EMAIL;
+
+class Tpl2Email extends AbstractAction
{
public function executeAction(): void
{
$template_name = $this->getElement(2);
- if ($etpl = \Yakamara\YForm\Email\Template::getTemplate($template_name)) {
+ if ($etpl = Template::getTemplate($template_name)) {
$email_to = rex::getErrorEmail();
if (filter_var($this->getElement(3), FILTER_VALIDATE_EMAIL)) {
@@ -29,19 +32,11 @@ public function executeAction(): void
$email_to_name = $this->getElement(4);
$warning_message = $this->getElement(5);
- // BC
- if ('' == $this->getElement(3) && filter_var($this->getElement(4), FILTER_VALIDATE_EMAIL)) {
- $email_to = $this->getElement(4);
- $email_to_name = $this->getElement(5);
- $warning_message = $this->getElement(6);
- }
- // End BC
-
if ($this->params['debug']) {
dump($etpl);
}
- $etpl = \Yakamara\YForm\Email\Template::replaceVars($etpl, $this->params['value_pool']['email']);
+ $etpl = Template::replaceVars($etpl, $this->params['value_pool']['email']);
$etpl['mail_to'] = $email_to;
$etpl['mail_to_name'] = $email_to_name;
@@ -66,7 +61,7 @@ public function executeAction(): void
dump($etpl);
}
- if (!\Yakamara\YForm\Email\Template::sendMail($etpl, $template_name)) {
+ if (!Template::sendMail($etpl, $template_name)) {
if ($this->params['debug']) {
dump('email could not be sent');
}
@@ -83,7 +78,6 @@ public function executeAction(): void
if ($this->params['debug']) {
dump('Template: "' . rex_escape($template_name) . '" not found');
}
-
}
public function getDescription(): string
diff --git a/lib/RexVar/TableData.php b/lib/RexVar/TableData.php
index d840ec3ee..d802a3390 100644
--- a/lib/RexVar/TableData.php
+++ b/lib/RexVar/TableData.php
@@ -16,8 +16,8 @@
use rex_i18n;
use rex_select;
use rex_var;
-use rex_yform_value_be_manager_relation;
use Yakamara\YForm\Manager\Table\Table;
+use Yakamara\YForm\Value\BackendManagerRelation;
use function in_array;
@@ -65,7 +65,7 @@ protected function getOutput()
if ('' != $value) {
$valueArray = explode(',', $value);
foreach ($valueArray as $valueId) {
- $listValues = rex_yform_value_be_manager_relation::getListValues($table->getTableName(), $fieldName, ['id' => $valueId]);
+ $listValues = BackendManagerRelation::getListValues($table->getTableName(), $fieldName, ['id' => $valueId]);
if (isset($listValues[$valueId])) {
$options[] = ['id' => $valueId, 'name' => rex_formatter::truncate($listValues[$valueId] . ' id=[' . $valueId . ']', ['length' => 50])];
$values[] = $valueId;
@@ -78,7 +78,7 @@ protected function getOutput()
$value = self::getMultipleWidget($id, 'REX_INPUT_VALUE[' . $id . ']', $value, $args);
} else {
$valueName = '';
- $listValues = rex_yform_value_be_manager_relation::getListValues($table->getTableName(), $fieldName, ['id' => $value]);
+ $listValues = BackendManagerRelation::getListValues($table->getTableName(), $fieldName, ['id' => $value]);
if (isset($listValues[$value])) {
$valueName = rex_formatter::truncate($listValues[$value], ['length' => 50]);
}
diff --git a/lib/yform/validate/abstract.php b/lib/Validate/AbstractValidate.php
similarity index 82%
rename from lib/yform/validate/abstract.php
rename to lib/Validate/AbstractValidate.php
index 378635596..97be992da 100644
--- a/lib/yform/validate/abstract.php
+++ b/lib/Validate/AbstractValidate.php
@@ -1,13 +1,11 @@
www.yakamara.de
- */
-
-abstract class rex_yform_validate_abstract extends rex_yform_base_abstract
+namespace Yakamara\YForm\Validate;
+
+use rex_addon;
+use Yakamara\YForm\AbstractBase;
+
+abstract class AbstractValidate extends AbstractBase
{
public $validateObjects = [];
diff --git a/lib/yform/validate/compare.php b/lib/Validate/Compare.php
similarity index 93%
rename from lib/yform/validate/compare.php
rename to lib/Validate/Compare.php
index 9c013f110..d57d68b78 100644
--- a/lib/yform/validate/compare.php
+++ b/lib/Validate/Compare.php
@@ -1,13 +1,10 @@
www.yakamara.de
- */
+namespace Yakamara\YForm\Validate;
-class rex_yform_validate_compare extends rex_yform_validate_abstract
+use rex_i18n;
+
+class Compare extends AbstractValidate
{
public function enterObject()
{
diff --git a/lib/yform/validate/compare_value.php b/lib/Validate/CompareValue.php
similarity index 92%
rename from lib/yform/validate/compare_value.php
rename to lib/Validate/CompareValue.php
index b82de3891..657312920 100644
--- a/lib/yform/validate/compare_value.php
+++ b/lib/Validate/CompareValue.php
@@ -1,13 +1,10 @@
www.yakamara.de
- */
+namespace Yakamara\YForm\Validate;
-class rex_yform_validate_compare_value extends rex_yform_validate_abstract
+use rex_i18n;
+
+class CompareValue extends AbstractValidate
{
public function enterObject()
{
diff --git a/lib/yform/validate/customfunction.php b/lib/Validate/CustomFunction.php
similarity index 94%
rename from lib/yform/validate/customfunction.php
rename to lib/Validate/CustomFunction.php
index ef7cd1009..3b3830435 100644
--- a/lib/yform/validate/customfunction.php
+++ b/lib/Validate/CustomFunction.php
@@ -1,13 +1,16 @@
www.yakamara.de
- */
+namespace Yakamara\YForm\Validate;
-class rex_yform_validate_customfunction extends rex_yform_validate_abstract
+use rex_i18n;
+
+use function call_user_func;
+use function count;
+use function is_array;
+use function is_callable;
+use function is_string;
+
+class CustomFunction extends AbstractValidate
{
public function customfunction_execute()
{
diff --git a/lib/yform/validate/in_names.php b/lib/Validate/InNames.php
similarity index 85%
rename from lib/yform/validate/in_names.php
rename to lib/Validate/InNames.php
index e6735d4ce..38292a53f 100644
--- a/lib/yform/validate/in_names.php
+++ b/lib/Validate/InNames.php
@@ -1,13 +1,10 @@
www.yakamara.de
- */
-
-class rex_yform_validate_in_names extends rex_yform_validate_abstract
+namespace Yakamara\YForm\Validate;
+
+use function in_array;
+
+class InNames extends AbstractValidate
{
public function enterObject()
{
diff --git a/lib/yform/validate/in_table.php b/lib/Validate/InTable.php
similarity index 90%
rename from lib/yform/validate/in_table.php
rename to lib/Validate/InTable.php
index e81841f8e..87165e755 100644
--- a/lib/yform/validate/in_table.php
+++ b/lib/Validate/InTable.php
@@ -1,13 +1,14 @@
www.yakamara.de
- */
+namespace Yakamara\YForm\Validate;
-class rex_yform_validate_in_table extends rex_yform_validate_abstract
+use rex_sql;
+
+use function count;
+use function in_array;
+use function is_array;
+
+class InTable extends AbstractValidate
{
public function enterObject()
{
diff --git a/lib/yform/validate/intfromto.php b/lib/Validate/IntFromTo.php
similarity index 87%
rename from lib/yform/validate/intfromto.php
rename to lib/Validate/IntFromTo.php
index df9619cf7..f5dd86e74 100644
--- a/lib/yform/validate/intfromto.php
+++ b/lib/Validate/IntFromTo.php
@@ -1,13 +1,10 @@
www.yakamara.de
- */
-
-class rex_yform_validate_intfromto extends rex_yform_validate_abstract
+namespace Yakamara\YForm\Validate;
+
+use rex_i18n;
+
+class IntFromTo extends AbstractValidate
{
public function enterObject()
{
diff --git a/lib/yform/validate/empty.php b/lib/Validate/IsEmpty.php
similarity index 88%
rename from lib/yform/validate/empty.php
rename to lib/Validate/IsEmpty.php
index a568077ac..3a92fddd4 100644
--- a/lib/yform/validate/empty.php
+++ b/lib/Validate/IsEmpty.php
@@ -1,13 +1,12 @@
www.yakamara.de
- */
-
-class rex_yform_validate_empty extends rex_yform_validate_abstract
+namespace Yakamara\YForm\Validate;
+
+use rex_i18n;
+
+use function in_array;
+
+class IsEmpty extends AbstractValidate
{
public function enterObject()
{
diff --git a/lib/yform/validate/password_policy.php b/lib/Validate/PasswordPolicy.php
similarity index 91%
rename from lib/yform/validate/password_policy.php
rename to lib/Validate/PasswordPolicy.php
index b2dc98b0b..04f5a20f1 100644
--- a/lib/yform/validate/password_policy.php
+++ b/lib/Validate/PasswordPolicy.php
@@ -1,6 +1,14 @@
www.yakamara.de
- */
-
-class rex_yform_validate_preg_match extends rex_yform_validate_abstract
+namespace Yakamara\YForm\Validate;
+
+use rex_i18n;
+
+use function count;
+
+class PregMatch extends AbstractValidate
{
public function enterObject()
{
diff --git a/lib/yform/validate/size.php b/lib/Validate/Size.php
similarity index 85%
rename from lib/yform/validate/size.php
rename to lib/Validate/Size.php
index 5ec90e62c..67d96ffbc 100644
--- a/lib/yform/validate/size.php
+++ b/lib/Validate/Size.php
@@ -1,13 +1,10 @@
www.yakamara.de
- */
-
-class rex_yform_validate_size extends rex_yform_validate_abstract
+namespace Yakamara\YForm\Validate;
+
+use rex_i18n;
+
+class Size extends AbstractValidate
{
public function enterObject()
{
diff --git a/lib/yform/validate/size_range.php b/lib/Validate/SizeRange.php
similarity index 88%
rename from lib/yform/validate/size_range.php
rename to lib/Validate/SizeRange.php
index 1c93a5245..9e07ab30b 100644
--- a/lib/yform/validate/size_range.php
+++ b/lib/Validate/SizeRange.php
@@ -1,13 +1,10 @@
www.yakamara.de
- */
+namespace Yakamara\YForm\Validate;
-class rex_yform_validate_size_range extends rex_yform_validate_abstract
+use rex_i18n;
+
+class SizeRange extends AbstractValidate
{
public function enterObject()
{
diff --git a/lib/yform/validate/type.php b/lib/Validate/Type.php
similarity index 97%
rename from lib/yform/validate/type.php
rename to lib/Validate/Type.php
index 371aec750..965d099e5 100644
--- a/lib/yform/validate/type.php
+++ b/lib/Validate/Type.php
@@ -1,13 +1,15 @@
www.yakamara.de
- */
-
-class rex_yform_validate_type extends rex_yform_validate_abstract
+namespace Yakamara\YForm\Validate;
+
+use DateTime;
+use rex_i18n;
+
+use function function_exists;
+
+use const JSON_ERROR_NONE;
+
+class Type extends AbstractValidate
{
public function enterObject()
{
diff --git a/lib/yform/validate/unique.inc.php b/lib/Validate/Unique.php
similarity index 93%
rename from lib/yform/validate/unique.inc.php
rename to lib/Validate/Unique.php
index b64a7e653..43dc13037 100644
--- a/lib/yform/validate/unique.inc.php
+++ b/lib/Validate/Unique.php
@@ -1,13 +1,15 @@
www.yakamara.de
- */
+namespace Yakamara\YForm\Validate;
-class rex_yform_validate_unique extends rex_yform_validate_abstract
+use rex_i18n;
+use rex_sql;
+
+use function count;
+use function in_array;
+use function is_array;
+
+class Unique extends AbstractValidate
{
public function enterObject()
{
diff --git a/lib/yform/value/abstract.php b/lib/Value/AbstractValue.php
similarity index 94%
rename from lib/yform/value/abstract.php
rename to lib/Value/AbstractValue.php
index 7fc88e11c..0f59ab0b2 100644
--- a/lib/yform/value/abstract.php
+++ b/lib/Value/AbstractValue.php
@@ -1,13 +1,15 @@
www.yakamara.de
- */
-
-abstract class rex_yform_value_abstract extends rex_yform_base_abstract
+namespace Yakamara\YForm\Value;
+
+use rex_i18n;
+use Yakamara\YForm\AbstractBase;
+use Yakamara\YForm\YForm;
+
+use function in_array;
+use function is_array;
+
+abstract class AbstractValue extends AbstractBase
{
public $element_values = [];
@@ -252,11 +254,6 @@ public function getDatabaseFieldTypes()
$definitions = $this->getDefinitions();
$db_types = [];
- // deprecated
- if (isset($definitions['dbtype'])) {
- $definitions['db_type'] = [$definitions['dbtype']];
- }
-
if (!isset($definitions['db_type'])) {
$definitions['db_type'] = [];
} elseif (!is_array($definitions['db_type'])) {
@@ -312,7 +309,7 @@ public function canView(bool $viewable = true)
public function isEditable()
{
- /** @var \Yakamara\YForm\YForm $yform */
+ /** @var YForm $yform */
$yform = $this->params['this'];
if (!$yform->isEditable()) {
return false;
@@ -326,7 +323,7 @@ public function isEditable()
public function isViewable()
{
- /** @var \Yakamara\YForm\YForm $yform */
+ /** @var YForm $yform */
$yform = $this->params['this'];
if (!$yform->isViewable()) {
return false;
diff --git a/lib/yform/value/article.php b/lib/Value/Article.php
similarity index 65%
rename from lib/yform/value/article.php
rename to lib/Value/Article.php
index 1153697df..94210ed84 100644
--- a/lib/yform/value/article.php
+++ b/lib/Value/Article.php
@@ -1,13 +1,10 @@
www.yakamara.de
- */
+namespace Yakamara\YForm\Value;
-class rex_yform_value_article extends rex_yform_value_abstract
+use rex_article_content;
+
+class Article extends AbstractValue
{
public function enterObject()
{
diff --git a/lib/yform/value/be_link.php b/lib/Value/BackendLink.php
similarity index 78%
rename from lib/yform/value/be_link.php
rename to lib/Value/BackendLink.php
index 3a7e3ae41..73161a65a 100644
--- a/lib/yform/value/be_link.php
+++ b/lib/Value/BackendLink.php
@@ -1,13 +1,22 @@
www.yakamara.de
- */
-
-class rex_yform_value_be_link extends rex_yform_value_abstract
+namespace Yakamara\YForm\Value;
+
+use rex_api_function;
+use rex_extension;
+use rex_extension_point;
+use rex_i18n;
+use rex_sql;
+use rex_view;
+use Yakamara\YForm\Manager\Field;
+use Yakamara\YForm\Manager\Query;
+use Yakamara\YForm\Manager\Table\Table;
+
+use function array_slice;
+use function count;
+use function in_array;
+
+class BackendLink extends AbstractValue
{
public function enterObject()
{
@@ -72,19 +81,19 @@ public static function getListValue($params)
public static function isArticleInUse(rex_extension_point $ep)
{
- $rexApiCall = rex_request(\rex_api_function::REQ_CALL_PARAM, 'string', '');
+ $rexApiCall = rex_request(rex_api_function::REQ_CALL_PARAM, 'string', '');
if ('category_delete' == $rexApiCall || 'article_delete' == $rexApiCall) {
$id = ('category_delete' == $rexApiCall) ? rex_request('category-id', 'int', 0) : rex_request('article_id', 'int', 0);
$article = \rex_article::get($id);
if ($article) {
- $sql = \rex_sql::factory();
- $sql->setQuery('SELECT * FROM `' . \Yakamara\YForm\Manager\Field::table() . '` LIMIT 0');
+ $sql = rex_sql::factory();
+ $sql->setQuery('SELECT * FROM `' . Field::table() . '` LIMIT 0');
$columns = $sql->getFieldnames();
$select = in_array('multiple', $columns) ? ', `multiple`' : '';
- $fields = $sql->getArray('SELECT `table_name`, `name`' . $select . ' FROM `' . \Yakamara\YForm\Manager\Field::table() . '` WHERE `type_id`="value" AND `type_name` IN("be_link")');
- $fields = \rex_extension::registerPoint(new \rex_extension_point('YFORM_ARTICLE_IS_IN_USE', $fields));
+ $fields = $sql->getArray('SELECT `table_name`, `name`' . $select . ' FROM `' . Field::table() . '` WHERE `type_id`="value" AND `type_name` IN("be_link")');
+ $fields = rex_extension::registerPoint(new \rex_extension_point('YFORM_ARTICLE_IS_IN_USE', $fields));
if (count($fields)) {
$tables = [];
@@ -102,8 +111,8 @@ public static function isArticleInUse(rex_extension_point $ep)
$items = $sql->getArray('SELECT `id` FROM ' . $tableName . ' WHERE ' . implode(' OR ', $conditions));
if (count($items)) {
foreach ($items as $item) {
- $sqlData = \rex_sql::factory();
- $sqlData->setQuery('SELECT `name` FROM `' . \Yakamara\YForm\Manager\Table\Table::table() . '` WHERE `table_name` = "' . $tableName . '"');
+ $sqlData = rex_sql::factory();
+ $sqlData->setQuery('SELECT `name` FROM `' . Table::table() . '` WHERE `table_name` = "' . $tableName . '"');
$url = rex_yform_manager::url($tableName, $item['id']);
$messages .= '
' . $sqlData->getValue('name') . ' [id=' . $item['id'] . ']';
}
@@ -111,13 +120,13 @@ public static function isArticleInUse(rex_extension_point $ep)
}
if ('' != $messages) {
- $_REQUEST[\rex_api_function::REQ_CALL_PARAM] = '';
+ $_REQUEST[rex_api_function::REQ_CALL_PARAM] = '';
- \rex_extension::register('PAGE_TITLE_SHOWN', static function (rex_extension_point $ep) use ($article, $messages) {
- $warning = $article->isStartArticle() ? \rex_i18n::msg('yform_structure_category_could_not_be_deleted') : \rex_i18n::msg('yform_structure_article_could_not_be_deleted');
+ rex_extension::register('PAGE_TITLE_SHOWN', static function (rex_extension_point $ep) use ($article, $messages) {
+ $warning = $article->isStartArticle() ? rex_i18n::msg('yform_structure_category_could_not_be_deleted') : rex_i18n::msg('yform_structure_article_could_not_be_deleted');
$warning .= '
';
$subject = $ep->getSubject();
- $ep->setSubject(\rex_view::error($warning) . $subject);
+ $ep->setSubject(rex_view::error($warning) . $subject);
});
}
}
@@ -139,7 +148,7 @@ public static function getSearchField($params)
public static function getSearchFilter($params)
{
$value = trim($params['value']);
- /** @var \Yakamara\YForm\Manager\Query $query */
+ /** @var Query $query */
$query = $params['query'];
$field = $query->getTableAlias() . '.' . $params['field']->getName();
return '' == $value ? $query : $query->whereListContains($field, $value);
diff --git a/lib/yform/value/be_manager_relation.php b/lib/Value/BackendManagerRelation.php
similarity index 99%
rename from lib/yform/value/be_manager_relation.php
rename to lib/Value/BackendManagerRelation.php
index 0c2174181..2aba38caa 100644
--- a/lib/yform/value/be_manager_relation.php
+++ b/lib/Value/BackendManagerRelation.php
@@ -1,13 +1,12 @@
www.yakamara.de
- */
-
-class rex_yform_value_be_manager_relation extends rex_yform_value_abstract
+namespace Yakamara\YForm\Value;
+
+use rex;
+use rex_i18n;
+use rex_sql;
+
+class BackendManagerRelation extends \Yakamara\YForm\Value\AbstractValue
{
public static $yform_list_values = [];
diff --git a/lib/yform/value/be_media.php b/lib/Value/BackendMedia.php
similarity index 85%
rename from lib/yform/value/be_media.php
rename to lib/Value/BackendMedia.php
index 657a5824e..3a6025ed8 100644
--- a/lib/yform/value/be_media.php
+++ b/lib/Value/BackendMedia.php
@@ -1,13 +1,22 @@
www.yakamara.de
- */
-
-class rex_yform_value_be_media extends rex_yform_value_abstract
+namespace Yakamara\YForm\Value;
+
+use rex_extension;
+use rex_extension_point;
+use rex_i18n;
+use rex_media;
+use rex_sql;
+use Yakamara\YForm\Manager\Field;
+use Yakamara\YForm\Manager\Manager;
+use Yakamara\YForm\Manager\Table\Table;
+
+use function array_slice;
+use function count;
+use function in_array;
+use function is_string;
+
+class BackendMedia extends AbstractValue
{
public function enterObject()
{
@@ -98,12 +107,12 @@ public static function getListValue($params)
public static function getSearchField($params)
{
- rex_yform_value_text::getSearchField($params);
+ Text::getSearchField($params);
}
public static function getSearchFilter($params)
{
- return rex_yform_value_text::getSearchFilter($params);
+ return Text::getSearchFilter($params);
}
public static function isMediaInUse(rex_extension_point $ep)
@@ -111,14 +120,14 @@ public static function isMediaInUse(rex_extension_point $ep)
$params = $ep->getParams();
$warning = $ep->getSubject();
- $sql = \rex_sql::factory();
- $sql->setQuery('SELECT * FROM `' . \Yakamara\YForm\Manager\Field::table() . '` LIMIT 0');
+ $sql = rex_sql::factory();
+ $sql->setQuery('SELECT * FROM `' . Field::table() . '` LIMIT 0');
$columns = $sql->getFieldnames();
$select = in_array('multiple', $columns) ? ', `multiple`' : '';
- $fields = $sql->getArray('SELECT `table_name`, `name`' . $select . ' FROM `' . \Yakamara\YForm\Manager\Field::table() . '` WHERE `type_id`="value" AND `type_name` IN("be_media")');
- $fields = \rex_extension::registerPoint(new \rex_extension_point('YFORM_MEDIA_IS_IN_USE', $fields));
+ $fields = $sql->getArray('SELECT `table_name`, `name`' . $select . ' FROM `' . Field::table() . '` WHERE `type_id`="value" AND `type_name` IN("be_media")');
+ $fields = rex_extension::registerPoint(new \rex_extension_point('YFORM_MEDIA_IS_IN_USE', $fields));
if (!count($fields)) {
return $warning;
@@ -141,9 +150,9 @@ public static function isMediaInUse(rex_extension_point $ep)
$items = $sql->getArray('SELECT `id` FROM ' . $tableName . ' WHERE ' . implode(' OR ', $conditions));
if (count($items)) {
foreach ($items as $item) {
- $sqlData = \rex_sql::factory();
- $sqlData->setQuery('SELECT `name` FROM `' . \Yakamara\YForm\Manager\Table\Table::table() . '` WHERE `table_name` = "' . $tableName . '"');
- $editUrl = rex_yform_manager::url($tableName, $item['id']);
+ $sqlData = rex_sql::factory();
+ $sqlData->setQuery('SELECT `name` FROM `' . Table::table() . '` WHERE `table_name` = "' . $tableName . '"');
+ $editUrl = Manager::url($tableName, $item['id']);
$messages .= '' . $sqlData->getValue('name') . ' [id=' . $item['id'] . ']';
}
}
diff --git a/lib/yform/value/be_table.php b/lib/Value/BackendTable.php
similarity index 95%
rename from lib/yform/value/be_table.php
rename to lib/Value/BackendTable.php
index 6fa8942d3..2f4e5c84b 100644
--- a/lib/yform/value/be_table.php
+++ b/lib/Value/BackendTable.php
@@ -1,6 +1,14 @@
$col) {
// Use ;; for separating choice columns instead of ,
- $values = explode('|', trim(trim(str_replace(';;', ',', \Yakamara\YForm\YForm::unhtmlentities($col))), '|'));
+ $values = explode('|', trim(trim(str_replace(';;', ',', YForm::unhtmlentities($col))), '|'));
if (1 == count($values)) {
$values = ['text', 'text_' . $index, $values[0]];
}
@@ -79,8 +87,8 @@ public function enterObject()
$this->fieldData = $data;
- $yfparams = \Yakamara\YForm\YForm::factory()->objparams;
- $yfparams['this'] = \Yakamara\YForm\YForm::factory();
+ $yfparams = YForm::factory()->objparams;
+ $yfparams['this'] = YForm::factory();
/* TODO
* error class von validierung ans Eingabefeld übergeben
diff --git a/lib/yform/value/be_user.php b/lib/Value/BackendUser.php
similarity index 93%
rename from lib/yform/value/be_user.php
rename to lib/Value/BackendUser.php
index be91d5062..531a80fab 100644
--- a/lib/yform/value/be_user.php
+++ b/lib/Value/BackendUser.php
@@ -1,13 +1,11 @@
www.yakamara.de
- */
+namespace Yakamara\YForm\Value;
-class rex_yform_value_be_user extends rex_yform_value_abstract
+use rex;
+use rex_i18n;
+
+class BackendUser extends AbstractValue
{
public function enterObject()
{
diff --git a/lib/yform/value/checkbox.php b/lib/Value/Checkbox.php
similarity index 90%
rename from lib/yform/value/checkbox.php
rename to lib/Value/Checkbox.php
index 3f24f15fc..02ea5e413 100644
--- a/lib/yform/value/checkbox.php
+++ b/lib/Value/Checkbox.php
@@ -1,13 +1,14 @@
www.yakamara.de
- */
+namespace Yakamara\YForm\Value;
-class rex_yform_value_checkbox extends rex_yform_value_abstract
+use rex_i18n;
+use Yakamara\YForm\Manager\Field;
+use Yakamara\YForm\Manager\Query;
+
+use function count;
+
+class Checkbox extends AbstractValue
{
public function enterObject()
{
@@ -59,7 +60,7 @@ public function getDefinitions(): array
'db_type' => ['tinyint(1)'],
'famous' => true,
'hooks' => [
- 'preDefault' => static function (Yakamara\YForm\Manager\Field $field) {
+ 'preDefault' => static function (Field $field) {
return (1 == $field->getElement('default')) ? '1' : '0';
},
],
@@ -82,10 +83,10 @@ public static function getSearchField($params)
]);
}
- public static function getSearchFilter($params): Yakamara\YForm\Manager\Query
+ public static function getSearchFilter($params): Query
{
$value = $params['value'];
- /** @var \Yakamara\YForm\Manager\Query $query */
+ /** @var Query $query */
$query = $params['query'];
$field = $query->getTableAlias() . '.' . $params['field']->getName();
diff --git a/lib/yform/value/choice.php b/lib/Value/Choice.php
similarity index 97%
rename from lib/yform/value/choice.php
rename to lib/Value/Choice.php
index a5e1e6fca..ead0d1dd0 100644
--- a/lib/yform/value/choice.php
+++ b/lib/Value/Choice.php
@@ -1,10 +1,23 @@
choices, $options);
} else {
- /* @var rex_yform_choice_view $choice */
+ /* @var View $choice */
$options[$choice->getValue()] = $choice->getLabel();
}
}
diff --git a/lib/yform/value/csrf.php b/lib/Value/Csrf.php
similarity index 91%
rename from lib/yform/value/csrf.php
rename to lib/Value/Csrf.php
index 04297cb29..6d6a5d80c 100644
--- a/lib/yform/value/csrf.php
+++ b/lib/Value/Csrf.php
@@ -1,13 +1,12 @@
www.yakamara.de
- */
+namespace Yakamara\YForm\Value;
-class rex_yform_value_csrf extends rex_yform_value_abstract
+use rex;
+use rex_csrf_token;
+use rex_i18n;
+
+class Csrf extends AbstractValue
{
public function preValidateAction(): void
{
diff --git a/lib/yform/value/date.php b/lib/Value/Date.php
similarity index 97%
rename from lib/yform/value/date.php
rename to lib/Value/Date.php
index 93db34beb..acc60a069 100644
--- a/lib/yform/value/date.php
+++ b/lib/Value/Date.php
@@ -1,13 +1,17 @@
www.yakamara.de
- */
-
-class rex_yform_value_date extends rex_yform_value_abstract
+namespace Yakamara\YForm\Value;
+
+use DateTime;
+use rex_i18n;
+use Yakamara\YForm\Manager\Query;
+
+use function in_array;
+use function is_array;
+
+use const STR_PAD_LEFT;
+
+class Date extends AbstractValue
{
public const VALUE_DATE_DEFAULT_FORMAT = 'Y-m-d';
public const VALUE_DATE_FORMATS = ['d.m.Y' => 'd.m.Y', 'Y-m-d' => 'Y-m-d', 'd-m-Y' => 'd-m-Y', 'm-d-Y' => 'm-d-Y', 'Y' => 'Y', 'm' => 'm', 'm-Y' => 'm-Y', 'Y-m' => 'Y-m'];
@@ -89,13 +93,13 @@ public function enterObject()
if ('+' == mb_substr($this->getElement('year_end'), 0, 1)) {
$add_years = (int) mb_substr($this->getElement('year_end'), 1);
- $yearEnd = date('Y') + $add_years;
+ $yearEnd = (int) date('Y') + $add_years;
} else {
$yearEnd = (int) $this->getElement('year_end');
}
if ($yearEnd < $yearStart) {
- $yearEnd = date('Y') + 10;
+ $yearEnd = (int) date('Y') + 10;
}
if (!$this->isEditable()) {
@@ -180,7 +184,7 @@ public static function getSearchField($params)
public static function getSearchFilter($params)
{
$value = trim($params['value']);
- /** @var \Yakamara\YForm\Manager\Query $query */
+ /** @var Query $query */
$query = $params['query'];
$field = $query->getTableAlias() . '.' . $params['field']->getName();
diff --git a/lib/yform/value/datestamp.php b/lib/Value/DateStamp.php
similarity index 82%
rename from lib/yform/value/datestamp.php
rename to lib/Value/DateStamp.php
index 4358b8893..85d7a4dad 100644
--- a/lib/yform/value/datestamp.php
+++ b/lib/Value/DateStamp.php
@@ -1,13 +1,13 @@
www.yakamara.de
- */
+namespace Yakamara\YForm\Value;
-class rex_yform_value_datestamp extends rex_yform_value_abstract
+use DateTime;
+use rex;
+use rex_i18n;
+use rex_sql;
+
+class DateStamp extends AbstractValue
{
private string $value_datestamp_currentValue = '';
@@ -65,7 +65,7 @@ public function enterObject()
['value.datestamp-view.tpl.php', 'value.datetime-view.tpl.php', 'value.date-view.tpl.php', 'value.view.tpl.php'],
[
'type' => 'text',
- 'value' => ('' != $this->value_datestamp_currentValue) ? rex_yform_value_datetime::datetime_getFormattedDatetime($this->getElement('format'), $this->value_datestamp_currentValue) : '',
+ 'value' => ('' != $this->value_datestamp_currentValue) ? \Yakamara\YForm\Value\DateTime::datetime_getFormattedDatetime($this->getElement('format'), $this->value_datestamp_currentValue) : '',
'notice' => $notice,
],
);
@@ -74,7 +74,7 @@ public function enterObject()
['value.datestamp-view.tpl.php', 'value.datetime-view.tpl.php', 'value.date-view.tpl.php', 'value.view.tpl.php'],
[
'type' => 'text',
- 'value' => rex_yform_value_datetime::datetime_getFormattedDatetime($this->getElement('format'), $this->value_datestamp_currentValue),
+ 'value' => \Yakamara\YForm\Value\DateTime::datetime_getFormattedDatetime($this->getElement('format'), $this->value_datestamp_currentValue),
],
);
}
@@ -96,7 +96,7 @@ public function getDefinitions(): array
'values' => [
'name' => ['type' => 'name', 'label' => rex_i18n::msg('yform_values_defaults_name')],
'label' => ['type' => 'text', 'label' => rex_i18n::msg('yform_values_defaults_label')],
- 'format' => ['type' => 'choice', 'label' => rex_i18n::msg('yform_values_datetime_format'), 'choices' => rex_yform_value_datetime::VALUE_DATETIME_FORMATS, 'default' => rex_yform_value_datetime::VALUE_DATETIME_DEFAULT_FORMAT, 'notice' => rex_i18n::msg('yform_values_format_show_notice')],
+ 'format' => ['type' => 'choice', 'label' => rex_i18n::msg('yform_values_datetime_format'), 'choices' => \Yakamara\YForm\Value\DateTime::VALUE_DATETIME_FORMATS, 'default' => \Yakamara\YForm\Value\DateTime::VALUE_DATETIME_DEFAULT_FORMAT, 'notice' => rex_i18n::msg('yform_values_format_show_notice')],
'no_db' => ['type' => 'no_db', 'label' => rex_i18n::msg('yform_values_defaults_table'), 'default' => 0],
'only_empty' => ['type' => 'choice', 'label' => rex_i18n::msg('yform_values_datestamp_only_empty'), 'default' => '0', 'choices' => 'translate:yform_always=0,translate:yform_onlyifempty=1,translate:yform_never=2'],
'modify_default' => ['type' => 'text', 'label' => rex_i18n::msg('yform_values_date_modify_default'), 'notice' => rex_i18n::msg('yform_values_date_modify_default_notics')],
@@ -109,16 +109,16 @@ public function getDefinitions(): array
public static function getListValue($params)
{
- return rex_yform_value_datetime::getListValue($params);
+ return \Yakamara\YForm\Value\DateTime::getListValue($params);
}
public static function getSearchField($params)
{
- rex_yform_value_datetime::getSearchField($params);
+ \Yakamara\YForm\Value\DateTime::getSearchField($params);
}
public static function getSearchFilter($params)
{
- return rex_yform_value_datetime::getSearchFilter($params);
+ return \Yakamara\YForm\Value\DateTime::getSearchFilter($params);
}
}
diff --git a/lib/yform/value/datetime.php b/lib/Value/DateTime.php
similarity index 95%
rename from lib/yform/value/datetime.php
rename to lib/Value/DateTime.php
index 65c25110f..1edd60728 100644
--- a/lib/yform/value/datetime.php
+++ b/lib/Value/DateTime.php
@@ -1,13 +1,16 @@
www.yakamara.de
- */
-
-class rex_yform_value_datetime extends rex_yform_value_abstract
+namespace Yakamara\YForm\Value;
+
+use rex_i18n;
+use rex_sql;
+use Yakamara\YForm\Manager\Query;
+
+use function count;
+use function in_array;
+use function is_array;
+
+class DateTime extends AbstractValue
{
public const VALUE_DATETIME_DEFAULT_FORMAT = 'Y-m-d H:i:s';
public const VALUE_DATETIME_FORMATS = ['d.m.Y H:i:s' => 'd.m.Y H:i:s', 'Y-m-d H:i:s' => 'Y-m-d H:i:s', 'd-m-Y H:i:s' => 'd-m-Y H:i:s', 'm-d-Y H:i:s' => 'm-d-Y H:i:s', 'm-Y H:i:s' => 'm-Y H:i:s', 'Y-m H:i:s' => 'Y-m H:i:s', 'd-m H:i:s' => 'd-m H:i:s', 'm-d H:i:s' => 'm-d H:i:s', 'Y' => 'Y', 'Y-m' => 'Y-m'];
@@ -20,7 +23,7 @@ public function preValidateAction(): void
$value = date(rex_sql::FORMAT_DATETIME);
}
if ('' != $this->getElement('modify_default')) {
- $dt = new DateTime();
+ $dt = new \DateTime();
if (false !== $dt->modify($this->getElement('modify_default'))) {
$value = $dt->format(rex_sql::FORMAT_DATETIME);
}
@@ -99,7 +102,7 @@ public function enterObject()
if ('+' == mb_substr($this->getElement('year_end'), 0, 1)) {
$add_years = (int) mb_substr($this->getElement('year_end'), 1);
- $yearEnd = date('Y') + $add_years;
+ $yearEnd = (int) date('Y') + $add_years;
} elseif ('' != $this->getElement('year_end')) {
$yearEnd = (int) $this->getElement('year_end');
} else {
@@ -138,7 +141,7 @@ public function enterObject()
public static function datetime_getFormattedDatetime($format, $date)
{
$format = (in_array($format, self::VALUE_DATETIME_FORMATS, true)) ? $format : self::VALUE_DATETIME_DEFAULT_FORMAT;
- $DTdate = DateTime::createFromFormat('Y-m-d H:i:s', $date);
+ $DTdate = \DateTime::createFromFormat('Y-m-d H:i:s', $date);
return (!$date || !$DTdate || $date != $DTdate->format('Y-m-d H:i:s')) ? '[' . $date . ']' : $DTdate->format($format);
}
@@ -188,7 +191,7 @@ public static function getSearchField($params)
public static function getSearchFilter($params)
{
$value = trim($params['value']);
- /** @var \Yakamara\YForm\Manager\Query $query */
+ /** @var Query $query */
$query = $params['query'];
$field = $query->getTableAlias() . '.' . $params['field']->getName();
diff --git a/lib/yform/value/email.php b/lib/Value/Email.php
similarity index 87%
rename from lib/yform/value/email.php
rename to lib/Value/Email.php
index 1e04d24d0..30781ac00 100644
--- a/lib/yform/value/email.php
+++ b/lib/Value/Email.php
@@ -1,13 +1,10 @@
www.yakamara.de
- */
+namespace Yakamara\YForm\Value;
-class rex_yform_value_email extends rex_yform_value_abstract
+use rex_i18n;
+
+class Email extends AbstractValue
{
public function enterObject()
{
@@ -64,16 +61,16 @@ public function getDefinitions(): array
public static function getSearchField($params)
{
- rex_yform_value_text::getSearchField($params);
+ Text::getSearchField($params);
}
public static function getSearchFilter($params)
{
- return rex_yform_value_text::getSearchFilter($params);
+ return Text::getSearchFilter($params);
}
public static function getListValue($params)
{
- return rex_yform_value_text::getListValue($params);
+ return Text::getListValue($params);
}
}
diff --git a/lib/yform/value/emptyname.php b/lib/Value/EmptyName.php
similarity index 82%
rename from lib/yform/value/emptyname.php
rename to lib/Value/EmptyName.php
index d933d9d73..ce3a7e8ba 100644
--- a/lib/yform/value/emptyname.php
+++ b/lib/Value/EmptyName.php
@@ -1,13 +1,10 @@
www.yakamara.de
- */
+namespace Yakamara\YForm\Value;
-class rex_yform_value_emptyname extends rex_yform_value_abstract
+use rex_i18n;
+
+class EmptyName extends AbstractValue
{
public function enterObject()
{
@@ -54,16 +51,16 @@ public function getDefinitions(): array
public static function getSearchField($params)
{
- rex_yform_value_text::getSearchField($params);
+ Text::getSearchField($params);
}
public static function getSearchFilter($params)
{
- return rex_yform_value_text::getSearchFilter($params);
+ return Text::getSearchFilter($params);
}
public static function getListValue($params)
{
- return rex_yform_value_text::getListValue($params);
+ return Text::getListValue($params);
}
}
diff --git a/lib/yform/value/fieldset.php b/lib/Value/Fieldset.php
similarity index 87%
rename from lib/yform/value/fieldset.php
rename to lib/Value/Fieldset.php
index 34bab36c6..f5092bae2 100644
--- a/lib/yform/value/fieldset.php
+++ b/lib/Value/Fieldset.php
@@ -1,13 +1,13 @@
www.yakamara.de
- */
+namespace Yakamara\YForm\Value;
-class rex_yform_value_fieldset extends rex_yform_value_abstract
+use rex_i18n;
+
+use function in_array;
+use function is_array;
+
+class Fieldset extends AbstractValue
{
public static $fieldset_options = ['onlyclose' => 'onlyclose', 'onlycloseall' => 'onlycloseall', 'onlyopen' => 'onlyopen', 'closeandopen' => 'closeandopen'];
@@ -27,12 +27,6 @@ public function enterObject()
$attributes = $this->getElement('attributes');
$attributes = json_decode($attributes, true);
- // deprecated
- // BC yform < Version 4
- if ('' != $this->getElement('attributes') && !is_array($attributes)) {
- $attributes['class'] = $this->getElement('attributes');
- }
-
$this->setElement('attributes', $attributes);
switch ($option) {
diff --git a/lib/yform/value/generate_key.php b/lib/Value/GenerateKey.php
similarity index 91%
rename from lib/yform/value/generate_key.php
rename to lib/Value/GenerateKey.php
index 2dd960587..2e57b165e 100644
--- a/lib/yform/value/generate_key.php
+++ b/lib/Value/GenerateKey.php
@@ -1,13 +1,10 @@
www.yakamara.de
- */
-
-class rex_yform_value_generate_key extends rex_yform_value_abstract
+namespace Yakamara\YForm\Value;
+
+use rex_i18n;
+
+class GenerateKey extends \Yakamara\YForm\Value\AbstractValue
{
public function preValidateAction(): void
{
diff --git a/lib/yform/value/google_geocode.php b/lib/Value/GoogleGeoCode.php
similarity index 97%
rename from lib/yform/value/google_geocode.php
rename to lib/Value/GoogleGeoCode.php
index ac1ad5c0b..78d3a81f2 100644
--- a/lib/yform/value/google_geocode.php
+++ b/lib/Value/GoogleGeoCode.php
@@ -1,6 +1,10 @@
www.yakamara.de
- */
+namespace Yakamara\YForm\Value;
-class rex_yform_value_hashvalue extends rex_yform_value_abstract
+use rex_i18n;
+
+use function function_exists;
+
+class HashValue extends AbstractValue
{
public function postFormAction(): void
{
@@ -59,16 +58,16 @@ public function getDefinitions(): array
public static function getSearchField($params)
{
- rex_yform_value_text::getSearchField($params);
+ Text::getSearchField($params);
}
public static function getSearchFilter($params)
{
- return rex_yform_value_text::getSearchFilter($params);
+ return Text::getSearchFilter($params);
}
public static function getListValue($params)
{
- return rex_yform_value_text::getListValue($params);
+ return Text::getListValue($params);
}
}
diff --git a/lib/yform/value/hidden.php b/lib/Value/Hidden.php
similarity index 88%
rename from lib/yform/value/hidden.php
rename to lib/Value/Hidden.php
index a848d40fb..3c4b93410 100644
--- a/lib/yform/value/hidden.php
+++ b/lib/Value/Hidden.php
@@ -1,13 +1,10 @@
www.yakamara.de
- */
+namespace Yakamara\YForm\Value;
-class rex_yform_value_hidden extends rex_yform_value_abstract
+use function in_array;
+
+class Hidden extends AbstractValue
{
public function setValue($value)
{
diff --git a/lib/yform/value/html.php b/lib/Value/Html.php
similarity index 86%
rename from lib/yform/value/html.php
rename to lib/Value/Html.php
index a095e25e2..4cdc342c0 100644
--- a/lib/yform/value/html.php
+++ b/lib/Value/Html.php
@@ -1,13 +1,10 @@
www.yakamara.de
- */
-
-class rex_yform_value_html extends rex_yform_value_abstract
+namespace Yakamara\YForm\Value;
+
+use rex_i18n;
+
+class Html extends AbstractValue
{
public function enterObject()
{
diff --git a/lib/yform/value/ip.php b/lib/Value/IP.php
similarity index 80%
rename from lib/yform/value/ip.php
rename to lib/Value/IP.php
index ca9e0b77e..f7835644f 100644
--- a/lib/yform/value/ip.php
+++ b/lib/Value/IP.php
@@ -1,13 +1,10 @@
www.yakamara.de
- */
-
-class rex_yform_value_ip extends rex_yform_value_abstract
+namespace Yakamara\YForm\Value;
+
+use rex_i18n;
+
+class IP extends AbstractValue
{
public function enterObject()
{
@@ -44,16 +41,16 @@ public function getDefinitions(): array
public static function getSearchField($params)
{
- rex_yform_value_text::getSearchField($params);
+ Text::getSearchField($params);
}
public static function getSearchFilter($params)
{
- return rex_yform_value_text::getSearchFilter($params);
+ return Text::getSearchFilter($params);
}
public static function getListValue($params)
{
- return rex_yform_value_text::getListValue($params);
+ return Text::getListValue($params);
}
}
diff --git a/lib/yform/value/index.php b/lib/Value/Index.php
similarity index 92%
rename from lib/yform/value/index.php
rename to lib/Value/Index.php
index 5176c060a..2e3b71afc 100644
--- a/lib/yform/value/index.php
+++ b/lib/Value/Index.php
@@ -1,13 +1,19 @@
www.yakamara.de
- */
-
-class rex_yform_value_index extends rex_yform_value_abstract
+namespace Yakamara\YForm\Value;
+
+use LogicException;
+use rex_i18n;
+use rex_sql;
+use RuntimeException;
+use Yakamara\YForm\Manager\Field;
+use Yakamara\YForm\Manager\Table\Table;
+
+use function call_user_func;
+use function count;
+use function in_array;
+
+class Index extends AbstractValue
{
public function postFormAction(): void
{
@@ -109,7 +115,7 @@ private function addRelation(array &$relations, array $names)
private function getRelationValues(array $relations)
{
- $table = \Yakamara\YForm\Manager\Table\Table::get($this->params['main_table']);
+ $table = Table::get($this->params['main_table']);
$sql = rex_sql::factory();
$sql->setDebug($this->params['debug']);
@@ -154,8 +160,8 @@ private function getRelationValues(array $relations)
return $nextIndex;
};
- $addFieldsAndJoins = static function (array $columns, Yakamara\YForm\Manager\Field $relation, $index) use (&$addFieldsAndJoins, $addJoin, &$fields, $sql) {
- $table = \Yakamara\YForm\Manager\Table\Table::get($relation->getElement('table'));
+ $addFieldsAndJoins = static function (array $columns, Field $relation, $index) use (&$addFieldsAndJoins, $addJoin, &$fields, $sql) {
+ $table = Table::get($relation->getElement('table'));
$fieldFormat = 't%d.%s';
if ($relation->getElement('relation_table') || in_array($relation->getElement('type'), [1, 3, 4, 5])) {
@@ -183,7 +189,7 @@ private function getRelationValues(array $relations)
continue;
}
- $relationTable = \Yakamara\YForm\Manager\Table\Table::get($relation->getElement('relation_table'));
+ $relationTable = Table::get($relation->getElement('relation_table'));
$name = $columns['target'];
$relation = $relationTable->getValueField($name);
$relation['relation_table'] = true;
@@ -213,7 +219,7 @@ private function getRelationValues(array $relations)
}
$fromTable = $relation->getElement('relation_table');
- $relationTable = \Yakamara\YForm\Manager\Table\Table::get($fromTable);
+ $relationTable = Table::get($fromTable);
$relation = $relationTable->getValueField($columns['target']);
$relation['relation_table'] = true;
$type = 'relation_table';
diff --git a/lib/yform/value/integer.php b/lib/Value/Integer.php
similarity index 88%
rename from lib/yform/value/integer.php
rename to lib/Value/Integer.php
index 45325b2c0..b1661b2b5 100644
--- a/lib/yform/value/integer.php
+++ b/lib/Value/Integer.php
@@ -1,13 +1,11 @@
www.yakamara.de
- */
+namespace Yakamara\YForm\Value;
-class rex_yform_value_integer extends rex_yform_value_abstract
+use rex_i18n;
+use Yakamara\YForm\Manager\Query;
+
+class Integer extends AbstractValue
{
public function enterObject()
{
@@ -72,12 +70,12 @@ public static function getSearchField($params)
public static function getSearchFilter($params)
{
$value = $params['value'];
- /** @var \Yakamara\YForm\Manager\Query $query */
+ /** @var Query $query */
$query = $params['query'];
$field = $query->getTableAlias() . '.' . $params['field']->getName();
if ('(empty)' == $value) {
- return $query->whereNested(static function (Yakamara\YForm\Manager\Query $query) use ($field) {
+ return $query->whereNested(static function (Query $query) use ($field) {
$query
->where($field, '')
->where($field, null)
@@ -85,7 +83,7 @@ public static function getSearchFilter($params)
}, 'OR');
}
if ('!(empty)' == $value) {
- return $query->whereNested(static function (Yakamara\YForm\Manager\Query $query) use ($field) {
+ return $query->whereNested(static function (Query $query) use ($field) {
$query
->where($field, '', '<>')
->where($field, null, '<>')
diff --git a/lib/yform/value/number.php b/lib/Value/Number.php
similarity index 90%
rename from lib/yform/value/number.php
rename to lib/Value/Number.php
index 2a2b4732b..030be2b08 100644
--- a/lib/yform/value/number.php
+++ b/lib/Value/Number.php
@@ -1,13 +1,11 @@
www.yakamara.de
- */
+namespace Yakamara\YForm\Value;
-class rex_yform_value_number extends rex_yform_value_abstract
+use rex_i18n;
+use Yakamara\YForm\Manager\Field;
+
+class Number extends AbstractValue
{
public function enterObject()
{
@@ -79,7 +77,7 @@ public function getDefinitions(): array
'description' => rex_i18n::msg('yform_values_number_description'),
'db_type' => ['DECIMAL({precision},{scale})'],
'hooks' => [
- 'preCreate' => static function (Yakamara\YForm\Manager\Field $field, $db_type) {
+ 'preCreate' => static function (Field $field, $db_type) {
$db_type = str_replace('{precision}', (string) ($field->getElement('precision') ?? 6), $db_type);
$db_type = str_replace('{scale}', (string) ($field->getElement('scale') ?? 2), $db_type);
return $db_type;
@@ -91,16 +89,16 @@ public function getDefinitions(): array
public static function getSearchField($params)
{
- rex_yform_value_integer::getSearchField($params);
+ Integer::getSearchField($params);
}
public static function getSearchFilter($params)
{
- return rex_yform_value_integer::getSearchFilter($params);
+ return Integer::getSearchFilter($params);
}
public static function getListValue($params)
{
- return rex_yform_value_integer::getListValue($params);
+ return Integer::getListValue($params);
}
}
diff --git a/lib/yform/value/objparams.php b/lib/Value/ObjParams.php
similarity index 89%
rename from lib/yform/value/objparams.php
rename to lib/Value/ObjParams.php
index 8a52b66aa..9e05f118e 100644
--- a/lib/yform/value/objparams.php
+++ b/lib/Value/ObjParams.php
@@ -1,13 +1,10 @@
www.yakamara.de
- */
+namespace Yakamara\YForm\Value;
-class rex_yform_value_objparams extends rex_yform_value_abstract
+use function count;
+
+class ObjParams extends AbstractValue
{
public function init()
{
diff --git a/lib/yform/value/password.php b/lib/Value/Password.php
similarity index 87%
rename from lib/yform/value/password.php
rename to lib/Value/Password.php
index 717973e05..47ab16a26 100644
--- a/lib/yform/value/password.php
+++ b/lib/Value/Password.php
@@ -1,10 +1,10 @@
www.yakamara.de
- */
+namespace Yakamara\YForm\Value;
-class rex_yform_value_php extends rex_yform_value_abstract
+use rex_i18n;
+
+class Php extends AbstractValue
{
public function enterObject()
{
@@ -54,11 +51,6 @@ public static function getListValue($params)
$php = $params['params']['field']['php'];
$list = true;
- // BC
- if ('' == $php) {
- $php = $label;
- }
-
ob_start();
eval('?>' . $php);
$out = ob_get_clean();
diff --git a/lib/yform/value/prio.php b/lib/Value/Prio.php
similarity index 96%
rename from lib/yform/value/prio.php
rename to lib/Value/Prio.php
index 3a591d863..4f6825772 100644
--- a/lib/yform/value/prio.php
+++ b/lib/Value/Prio.php
@@ -1,13 +1,13 @@
www.yakamara.de
- */
-
-class rex_yform_value_prio extends rex_yform_value_abstract
+namespace Yakamara\YForm\Value;
+
+use rex_i18n;
+use rex_sql;
+
+use function is_array;
+
+class Prio extends AbstractValue
{
private $preEditScopeWhere;
private $debug = false;
diff --git a/lib/yform/value/resetbutton.php b/lib/Value/ResetButton.php
similarity index 64%
rename from lib/yform/value/resetbutton.php
rename to lib/Value/ResetButton.php
index ce78ed7d2..509ccb748 100644
--- a/lib/yform/value/resetbutton.php
+++ b/lib/Value/ResetButton.php
@@ -1,13 +1,8 @@
www.yakamara.de
- */
+namespace Yakamara\YForm\Value;
-class rex_yform_value_resetbutton extends rex_yform_value_abstract
+class ResetButton extends AbstractValue
{
public function enterObject()
{
diff --git a/lib/yform/value/showvalue.php b/lib/Value/ShowValue.php
similarity index 79%
rename from lib/yform/value/showvalue.php
rename to lib/Value/ShowValue.php
index d2d282cb8..40b46048a 100644
--- a/lib/yform/value/showvalue.php
+++ b/lib/Value/ShowValue.php
@@ -1,13 +1,10 @@
www.yakamara.de
- */
-
-class rex_yform_value_showvalue extends rex_yform_value_abstract
+namespace Yakamara\YForm\Value;
+
+use rex_i18n;
+
+class ShowValue extends AbstractValue
{
public function enterObject()
{
@@ -45,16 +42,16 @@ public function getDefinitions(): array
public static function getSearchField($params)
{
- rex_yform_value_text::getSearchField($params);
+ Text::getSearchField($params);
}
public static function getSearchFilter($params)
{
- return rex_yform_value_text::getSearchFilter($params);
+ return Text::getSearchFilter($params);
}
public static function getListValue($params)
{
- return rex_yform_value_text::getListValue($params);
+ return Text::getListValue($params);
}
}
diff --git a/lib/yform/value/signature.php b/lib/Value/Signature.php
similarity index 90%
rename from lib/yform/value/signature.php
rename to lib/Value/Signature.php
index fbabe35cd..05286b027 100644
--- a/lib/yform/value/signature.php
+++ b/lib/Value/Signature.php
@@ -1,13 +1,10 @@
www.yakamara.de
- */
-
-class rex_yform_value_signature extends rex_yform_value_abstract
+namespace Yakamara\YForm\Value;
+
+use rex_i18n;
+
+class Signature extends AbstractValue
{
public function enterObject()
{
diff --git a/lib/yform/value/submit.php b/lib/Value/Submit.php
similarity index 94%
rename from lib/yform/value/submit.php
rename to lib/Value/Submit.php
index 861e451a2..c3e68d922 100644
--- a/lib/yform/value/submit.php
+++ b/lib/Value/Submit.php
@@ -1,13 +1,13 @@
www.yakamara.de
- */
-
-class rex_yform_value_submit extends rex_yform_value_abstract
+namespace Yakamara\YForm\Value;
+
+use rex_i18n;
+
+use function count;
+use function in_array;
+
+class Submit extends AbstractValue
{
public function init()
{
diff --git a/lib/yform/value/text.php b/lib/Value/Text.php
similarity index 89%
rename from lib/yform/value/text.php
rename to lib/Value/Text.php
index cd979171a..9e1959046 100644
--- a/lib/yform/value/text.php
+++ b/lib/Value/Text.php
@@ -1,13 +1,12 @@
www.yakamara.de
- */
-
-class rex_yform_value_text extends rex_yform_value_abstract
+namespace Yakamara\YForm\Value;
+
+use rex_i18n;
+use Yakamara\YForm\Manager\Field;
+use Yakamara\YForm\Manager\Query;
+
+class Text extends AbstractValue
{
public function enterObject()
{
@@ -63,7 +62,7 @@ public function getDefinitions(): array
'db_type' => ['varchar(191)', 'text'],
'famous' => true,
'hooks' => [
- 'preDefault' => static function (Yakamara\YForm\Manager\Field $field) {
+ 'preDefault' => static function (Field $field) {
return $field->getElement('default');
},
],
@@ -78,12 +77,12 @@ public static function getSearchField($params)
public static function getSearchFilter($params)
{
$value = trim($params['value']);
- /** @var \Yakamara\YForm\Manager\Query $query */
+ /** @var Query $query */
$query = $params['query'];
$field = $query->getTableAlias() . '.' . $params['field']->getName();
if ('(empty)' == $value) {
- return $query->whereNested(static function (Yakamara\YForm\Manager\Query $query) use ($field) {
+ return $query->whereNested(static function (Query $query) use ($field) {
$query
->where($field, '')
->where($field, null)
@@ -91,7 +90,7 @@ public static function getSearchFilter($params)
}, 'OR');
}
if ('!(empty)' == $value) {
- return $query->whereNested(static function (Yakamara\YForm\Manager\Query $query) use ($field) {
+ return $query->whereNested(static function (Query $query) use ($field) {
$query
->where($field, '', '<>')
->where($field, null, '<>')
diff --git a/lib/yform/value/textarea.php b/lib/Value/Textarea.php
similarity index 88%
rename from lib/yform/value/textarea.php
rename to lib/Value/Textarea.php
index a1c3cc2e8..fda51d392 100644
--- a/lib/yform/value/textarea.php
+++ b/lib/Value/Textarea.php
@@ -1,13 +1,12 @@
www.yakamara.de
- */
+namespace Yakamara\YForm\Value;
-class rex_yform_value_textarea extends rex_yform_value_abstract
+use rex_i18n;
+
+use function is_string;
+
+class Textarea extends AbstractValue
{
public function enterObject()
{
@@ -69,16 +68,16 @@ public function getDefinitions(): array
public static function getSearchField($params)
{
- rex_yform_value_text::getSearchField($params);
+ Text::getSearchField($params);
}
public static function getSearchFilter($params)
{
- return rex_yform_value_text::getSearchFilter($params);
+ return Text::getSearchFilter($params);
}
public static function getListValue($params)
{
- return rex_yform_value_text::getListValue($params);
+ return Text::getListValue($params);
}
}
diff --git a/lib/yform/value/time.php b/lib/Value/Time.php
similarity index 94%
rename from lib/yform/value/time.php
rename to lib/Value/Time.php
index 56ced75f7..c9b2f4d95 100644
--- a/lib/yform/value/time.php
+++ b/lib/Value/Time.php
@@ -1,13 +1,13 @@
www.yakamara.de
- */
+namespace Yakamara\YForm\Value;
-class rex_yform_value_time extends rex_yform_value_abstract
+use rex_i18n;
+
+use function in_array;
+use function is_array;
+
+class Time extends AbstractValue
{
public const VALUE_TIME_DEFAULT_FORMAT = 'H:i:s';
public const VALUE_TIME_FORMATS = ['H:i:s' => 'H:i:s', 'H:i' => 'H:i', 'H' => 'H', 'G:i' => 'G:i', 'g:i a' => 'g:i a', 'g:i:s a' => 'g:i:s a', 'h:i a' => 'h:i a', 'h:i:s a' => 'h:i:s a'];
@@ -120,11 +120,11 @@ public static function getListValue($params)
public static function getSearchField($params)
{
- rex_yform_value_text::getSearchField($params);
+ Text::getSearchField($params);
}
public static function getSearchFilter($params)
{
- return rex_yform_value_text::getSearchFilter($params);
+ return Text::getSearchFilter($params);
}
}
diff --git a/lib/yform/value/upload.php b/lib/Value/Upload.php
similarity index 96%
rename from lib/yform/value/upload.php
rename to lib/Value/Upload.php
index 02086ed4c..d9ffa6495 100644
--- a/lib/yform/value/upload.php
+++ b/lib/Value/Upload.php
@@ -1,13 +1,40 @@
www.yakamara.de
- */
-
-class rex_yform_value_upload extends rex_yform_value_abstract
+namespace Yakamara\YForm\Value;
+
+use InvalidArgumentException;
+use rex;
+use rex_dir;
+use rex_i18n;
+use rex_list;
+use rex_login;
+use rex_path;
+use rex_request;
+use rex_type;
+use rex_url;
+use Yakamara\YForm\Manager\Field;
+use ZipArchive;
+
+use function array_key_exists;
+use function call_user_func;
+use function count;
+use function gettype;
+use function in_array;
+use function is_array;
+use function is_scalar;
+use function is_string;
+
+use const PATHINFO_EXTENSION;
+use const UPLOAD_ERR_CANT_WRITE;
+use const UPLOAD_ERR_EXTENSION;
+use const UPLOAD_ERR_FORM_SIZE;
+use const UPLOAD_ERR_INI_SIZE;
+use const UPLOAD_ERR_NO_FILE;
+use const UPLOAD_ERR_NO_TMP_DIR;
+use const UPLOAD_ERR_OK;
+use const UPLOAD_ERR_PARTIAL;
+
+class Upload extends AbstractValue
{
public string $_upload_sessionKey = '';
@@ -531,12 +558,12 @@ public static function upload_checkExtensions(array $FILE, array $configuration)
public static function getSearchField($params)
{
- rex_yform_value_text::getSearchField($params);
+ Text::getSearchField($params);
}
public static function getSearchFilter($params)
{
- return rex_yform_value_text::getSearchFilter($params);
+ return Text::getSearchFilter($params);
}
public static function getListValue($params)
@@ -552,7 +579,7 @@ public static function getListValue($params)
$return = $value;
if (rex::isBackend() && $list) {
- $field = new \Yakamara\YForm\Manager\Field($params['params']['field']);
+ $field = new Field($params['params']['field']);
if ('' != $value) {
$return = '' . rex_escape($value) . '';
}
diff --git a/lib/yform/value/uuid.php b/lib/Value/Uuid.php
similarity index 87%
rename from lib/yform/value/uuid.php
rename to lib/Value/Uuid.php
index bb759dc3b..261f3fb89 100644
--- a/lib/yform/value/uuid.php
+++ b/lib/Value/Uuid.php
@@ -1,13 +1,13 @@
www.alexplus.de
- */
+namespace Yakamara\YForm\Value;
-class rex_yform_value_uuid extends rex_yform_value_abstract
+use rex_i18n;
+
+use function chr;
+use function ord;
+
+class Uuid extends AbstractValue
{
public function preValidateAction(): void
{
@@ -72,16 +72,16 @@ public function getDefinitions(): array
public static function getSearchField($params)
{
- rex_yform_value_text::getSearchField($params);
+ Text::getSearchField($params);
}
public static function getSearchFilter($params)
{
- return rex_yform_value_text::getSearchFilter($params);
+ return Text::getSearchFilter($params);
}
public static function getListValue($params)
{
- return rex_yform_value_text::getListValue($params);
+ return Text::getListValue($params);
}
}
diff --git a/lib/YForm.php b/lib/YForm.php
index bee02fa46..1ce29b6ad 100644
--- a/lib/YForm.php
+++ b/lib/YForm.php
@@ -21,9 +21,8 @@
use rex_i18n;
use rex_response;
use rex_sql;
-use rex_yform_base_abstract;
-use rex_yform_validate_abstract;
-use rex_yform_value_abstract;
+use Yakamara\YForm\Validate\AbstractValidate;
+use Yakamara\YForm\Value\AbstractValue;
use function array_key_exists;
use function count;
@@ -308,7 +307,7 @@ public function executeFields(): self
// 1. setValue direct via REQUEST
foreach ($this->objparams['values'] as $ValueObject) {
- /* @var rex_yform_value_abstract $ValueObject */
+ /* @var AbstractValue $ValueObject */
$ValueObject->setValue($this->getFieldValue($ValueObject->getName(), [$ValueObject->getId()]));
}
@@ -333,7 +332,7 @@ public function executeFields(): self
if (1 != $this->objparams['send'] && '' != $this->objparams['main_where']) {
foreach ($this->objparams['values'] as $i => $valueObject) {
- /** @var rex_yform_value_abstract $valueObject */
+ /** @var AbstractValue $valueObject */
if ($valueObject->getName()) {
if (isset($this->objparams['sql_object'])) {
$this->setFieldValue($valueObject->getName(), [$i], @$this->objparams['sql_object']->getValue($valueObject->getName()));
@@ -346,7 +345,7 @@ public function executeFields(): self
// 3. setValue direct via data Object
if (isset($this->objparams['data']) && is_array($this->objparams['data']) && count($this->objparams['data']) > 0) {
foreach ($this->objparams['values'] as $valueObject) {
- /** @var rex_yform_value_abstract $valueObject */
+ /** @var AbstractValue $valueObject */
if (isset($this->objparams['data'][$valueObject->getName()])) {
$valueObject->setValue($this->objparams['data'][$valueObject->getName()]);
}
@@ -365,9 +364,9 @@ public function executeFields(): self
// ----- validate form
- /* @var rex_yform_base_abstract $Object */
- /* @var rex_yform_validate_abstract $ValidateObject */
- /* @var rex_yform_value_abstract $valueObject */
+ /* @var AbstractBase $Object */
+ /* @var AbstractValidate $ValidateObject */
+ /* @var AbstractValue $valueObject */
foreach ($this->objparams['fields'] as $types) {
foreach ($types as $Object) {
@@ -446,7 +445,7 @@ public function initializeFields(): self
}
if (class_exists($class)) {
- /** @var rex_yform_base_abstract $Object */
+ /** @var AbstractBase $Object */
$Object = new $class();
$Object->loadParams($this->objparams, $element);
$Object->setId($i);
@@ -475,8 +474,6 @@ public function executeActions()
{
if ($this->isEditable()) {
if ($this->objparams['main_id'] > 0) {
- /** @deprecated use 'id' instead of 'ID' */
- $this->objparams['value_pool']['email']['ID'] = $this->objparams['main_id'];
$this->objparams['value_pool']['email']['id'] = $this->objparams['main_id'];
}
@@ -758,7 +755,7 @@ public static function showHelp(): string
if (2 == count($exploded)) {
$name = $exploded[1];
if ('abstract' != $name) {
- /** @var rex_yform_base_abstract $class */
+ /** @var AbstractBase $class */
$class = new $class();
$desc = trim($class->getDescription());
$definitions = $class->getDefinitions();
@@ -815,7 +812,7 @@ public static function getTypeArray(): array
if (2 == count($exploded)) {
$name = $exploded[1];
if ('abstract' != $name) {
- /** @var rex_yform_base_abstract $class */
+ /** @var AbstractBase $class */
$class = new $class();
$d = $class->getDefinitions();
if (count($d) > 0) {
diff --git a/lib/manager/collection.php b/lib/manager/collection.php
index e41ec6778..b8f78230a 100644
--- a/lib/manager/collection.php
+++ b/lib/manager/collection.php
@@ -13,10 +13,10 @@
use Closure;
use InvalidArgumentException;
use rex_i18n;
-use rex_yform_base_abstract;
-use rex_yform_value_abstract;
use SplFixedArray;
+use Yakamara\YForm\AbstractBase;
use Yakamara\YForm\Manager\Table\Table;
+use Yakamara\YForm\Value\AbstractValue;
use Yakamara\YForm\YForm;
use function array_slice;
@@ -462,10 +462,10 @@ public function getForm(): YForm
continue;
}
- /** @var class-string $class */
+ /** @var class-string<\Yakamara\YForm\AbstractBase> $class */
$class = 'rex_yform_' . $field->getType() . '_' . $field->getTypeName();
- /** @var rex_yform_base_abstract $cl */
+ /** @var AbstractBase $cl */
$cl = new $class();
$definitions = $cl->getDefinitions();
@@ -558,7 +558,7 @@ public function executeForm(YForm $yform, ?callable $afterFieldsExecuted = null)
if (1 == $yform->objparams['send'] && !$yform->objparams['warning_messages']) {
$ignoreFields = [];
- /** @var rex_yform_value_abstract $field */
+ /** @var AbstractValue $field */
foreach ($yform->objparams['values'] as $field) {
$key = $field->getElement('__multi_edit_checkbox');
if ($key && !$field->getValue()) {
diff --git a/lib/manager/dataset.php b/lib/manager/dataset.php
index fae2887ec..6a232d2b9 100644
--- a/lib/manager/dataset.php
+++ b/lib/manager/dataset.php
@@ -10,11 +10,11 @@
use rex_extension_point;
use rex_instance_pool_trait;
use rex_sql;
-use rex_yform_action_db;
-use rex_yform_base_abstract;
-use rex_yform_value_be_manager_relation;
use RuntimeException;
+use Yakamara\YForm\AbstractBase;
+use Yakamara\YForm\Action\Db;
use Yakamara\YForm\Manager\Table\Table;
+use Yakamara\YForm\Value\BackendManagerRelation;
use Yakamara\YForm\YForm;
use function array_key_exists;
@@ -31,10 +31,10 @@ class Dataset
private static bool $debug = false;
- /** @var array> */
+ /** @var array> */
private static array $tableToModel = [];
- /** @var array, string> */
+ /** @var array, string> */
private static array $modelToTable = [];
private string $table;
@@ -49,7 +49,7 @@ class Dataset
private bool $dataLoaded = false;
- /** @var array */
+ /** @var array */
private array $relatedCollections = [];
/** @var array */
@@ -142,9 +142,6 @@ public static function getRaw(int $id, ?string $table = null): self
});
}
- /**
- * @return \Yakamara\YForm\Manager\Collection
- */
public static function getAll(?string $table = null): Collection
{
return static::query($table)->find();
@@ -550,7 +547,7 @@ public function executeForm(YForm $yform, ?callable $afterFieldsExecuted = null)
return;
}
- /** @var rex_yform_action_db $dbAction */
+ /** @var Db $dbAction */
$dbAction = $ep->getParam('form');
if ($dbAction->getParam('manager_dataset') !== $this) {
return;
@@ -559,7 +556,7 @@ public function executeForm(YForm $yform, ?callable $afterFieldsExecuted = null)
$this->id = ((int) $dbAction->getParam('main_id')) ?: null;
if ($this->id) {
self::addInstance($this->id, $this);
- rex_yform_value_be_manager_relation::clearCache($this->table);
+ BackendManagerRelation::clearCache($this->table);
}
}, rex_extension::EARLY);
}
@@ -713,10 +710,10 @@ private function createForm(): YForm
$yform->setDebug(self::$debug);
foreach ($fields as $field) {
- /** @var class-string $class */
+ /** @var class-string<\Yakamara\YForm\AbstractBase> $class */
$class = 'rex_yform_' . $field->getType() . '_' . $field->getTypeName();
- /** @var rex_yform_base_abstract $cl */
+ /** @var AbstractBase $cl */
$cl = new $class();
$definitions = $cl->getDefinitions();
diff --git a/lib/manager/field.php b/lib/manager/field.php
index 4b81efbf1..ac926de29 100644
--- a/lib/manager/field.php
+++ b/lib/manager/field.php
@@ -6,8 +6,8 @@
use Exception;
use rex;
use rex_i18n;
-use rex_yform_validate_abstract;
-use rex_yform_value_abstract;
+use Yakamara\YForm\Validate\AbstractValidate;
+use Yakamara\YForm\Value\AbstractValue;
use function array_key_exists;
use function count;
@@ -21,7 +21,7 @@ class Field implements ArrayAccess
protected static $types = ['value', 'validate', 'action'];
protected static $protected_fields = ['id', 'table_name', 'prio', 'type_id', 'type_name', 'db_type', 'list_hidden', 'search', 'name', 'label', 'not_required'];
- /** @var rex_yform_value_abstract|rex_yform_validate_abstract */
+ /** @var AbstractValue|AbstractValidate */
protected $object;
/**
@@ -70,7 +70,7 @@ public function getType()
}
/**
- * @return mixed|rex_yform_validate_abstract|rex_yform_value_abstract|null
+ * @return mixed|AbstractValidate|AbstractValue|null
*/
public function getObject()
{
diff --git a/lib/manager/manager.php b/lib/manager/manager.php
index ff65a3c64..728aea761 100644
--- a/lib/manager/manager.php
+++ b/lib/manager/manager.php
@@ -23,14 +23,14 @@
use rex_sql;
use rex_url;
use rex_view;
-use rex_yform_base_abstract;
-use rex_yform_value_abstract;
-use rex_yform_value_be_manager_relation;
-use rex_yform_value_submit;
use Throwable;
+use Yakamara\YForm\AbstractBase;
use Yakamara\YForm\Manager\Table\Api;
use Yakamara\YForm\Manager\Table\Authorization;
use Yakamara\YForm\Manager\Table\Table;
+use Yakamara\YForm\Value\AbstractValue;
+use Yakamara\YForm\Value\BackendManagerRelation;
+use Yakamara\YForm\Value\Submit;
use Yakamara\YForm\YForm;
class Manager
@@ -322,7 +322,7 @@ public function getDataPage()
foreach ($this->table->getFields() as $field) {
$class = 'rex_yform_' . $field->getType() . '_' . $field->getTypeName();
- /** @var rex_yform_base_abstract $cl */
+ /** @var AbstractBase $cl */
$cl = new $class();
$definitions = $cl->getDefinitions();
@@ -397,7 +397,7 @@ public function getDataPage()
$form = '';
$sql_db->transactional(static function () use (&$form, &$yform, $data, $func) {
$afterFieldsExecuted = static function (YForm $yform) {
- /** @var rex_yform_value_abstract $valueObject */
+ /** @var AbstractValue $valueObject */
foreach ($yform->objparams['values'] as $valueObject) {
if ('submit' == $valueObject->getName()) {
if (2 == $valueObject->getValue()) { // apply
@@ -416,7 +416,7 @@ public function getDataPage()
// In den Feldern Anpassungen vornehmen
foreach ($yform->objparams['values'] as $k => $v) {
// Submit-Buttons von "Edit" auf "Add" zurückstellen
- if ($v instanceof rex_yform_value_submit) {
+ if ($v instanceof Submit) {
$yform->objparams['form_output'][$k] = str_replace(
[rex_i18n::msg('yform_save') . 'getElement('type')) {
+ if ($v instanceof BackendManagerRelation && 5 == $v->getElement('type')) {
$fieldName = preg_quote($v->getFieldName());
$pattern = '//';
$yform->objparams['form_output'][$k] = preg_replace($pattern, '', $yform->objparams['form_output'][$k]);
@@ -450,7 +450,7 @@ public function getDataPage()
case 'edit':
$submit_type = 1; // normal, 2=apply
foreach ($yform->objparams['values'] as $valueObject) {
- /** @var rex_yform_value_abstract $valueObject */
+ /** @var AbstractValue $valueObject */
if ('submit' == $valueObject->getName()) {
if (2 == $valueObject->getValue()) { // apply
$submit_type = 2;
diff --git a/lib/yform/action/abstract.php b/lib/yform/action/abstract.php
deleted file mode 100644
index dfac1b286..000000000
--- a/lib/yform/action/abstract.php
+++ /dev/null
@@ -1,18 +0,0 @@
-www.yakamara.de
- */
-
-abstract class rex_yform_action_abstract extends rex_yform_base_abstract
-{
- public $action = [];
-
- protected function getElementMappingOffset()
- {
- return 1;
- }
-}
diff --git a/lib/yform/action/createdb.php b/lib/yform/action/createdb.php
deleted file mode 100644
index 916bffe55..000000000
--- a/lib/yform/action/createdb.php
+++ /dev/null
@@ -1,50 +0,0 @@
-www.yakamara.de
- */
-
-class rex_yform_action_createdb extends rex_yform_action_abstract
-{
- public function executeAction(): void
- {
- $table_name = $this->getElement(2);
- $table_exists = false;
-
- $tables = rex_sql::factory()->getArray('show tables');
- foreach ($tables as $table) {
- if (current($table) == $table_name) {
- $table_exists = true;
- break;
- }
- }
-
- if (!$table_exists) {
- rex_sql::factory()->setQuery('CREATE TABLE `' . $table_name . '` (`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;');
- }
-
- $cols = [];
- foreach (rex_sql::factory()->getArray('show columns from ' . $table_name) as $k => $v) {
- $cols[] = $v['Field'];
- }
-
- foreach ($this->params['value_pool']['sql'] as $key => $value) {
- if (!in_array($key, $cols)) {
- rex_sql::factory()->setQuery('ALTER TABLE `' . $table_name . '` ADD `' . $key . '` TEXT NOT NULL;');
- }
- }
- }
-
- public function getDescription(): string
- {
- return 'action|createdb|tablename';
- }
-
- public function isDeprecated(): bool
- {
- return true;
- }
-}
diff --git a/rector.php b/rector.php
index fcdefc9cb..9a30a6102 100644
--- a/rector.php
+++ b/rector.php
@@ -38,6 +38,79 @@
'rex_yform_choice_list' => 'Yakamara\YForm\Choice\ChoiceList',
'rex_yform_choice_list_view' => 'Yakamara\YForm\Choice\ListView',
'rex_yform_choice_view' => 'Yakamara\YForm\Choice\View',
+
+ 'rex_yform_base_abstract' => 'Yakamara\YForm\AbstractBase',
+
+ 'rex_yform_action_abstract' => 'Yakamara\YForm\Action\AbstractAction',
+ 'rex_yform_action_callback' => 'Yakamara\YForm\Action\Callback',
+ 'rex_yform_action_copy_value' => 'Yakamara\YForm\Action\CopyValue',
+ 'rex_yform_action_create_table' => 'Yakamara\YForm\Action\CreateTable',
+ 'rex_yform_action_db_query' => 'Yakamara\YForm\Action\DbQuery',
+ 'rex_yform_action_db' => 'Yakamara\YForm\Action\Db',
+ 'rex_yform_action_email' => 'Yakamara\YForm\Action\Email',
+ 'rex_yform_action_encrypt_value' => 'Yakamara\YForm\Action\EncryptValue',
+ 'rex_yform_action_html' => 'Yakamara\YForm\Action\Html',
+ 'rex_yform_action_manage_db' => 'Yakamara\YForm\Action\ManageDb',
+ 'rex_yform_action_php' => 'Yakamara\YForm\Action\Php',
+ 'rex_yform_action_readtable' => 'Yakamara\YForm\Action\ReadTable',
+ 'rex_yform_action_redirect' => 'Yakamara\YForm\Action\Redirect',
+ 'rex_yform_action_showtext' => 'Yakamara\YForm\Action\ShowText',
+ 'rex_yform_action_tpl2email' => 'Yakamara\YForm\Action\Tpl2Email',
+
+ 'rex_yform_validate_abstract' => 'Yakamara\YForm\Validate\AbstractValidate',
+ 'rex_yform_validate_compare_value' => 'Yakamara\YForm\Validate\CompareValue',
+ 'rex_yform_validate_compare' => 'Yakamara\YForm\Validate\Compare',
+ 'rex_yform_validate_customfunction' => 'Yakamara\YForm\Validate\CustomFunction',
+ 'rex_yform_validate_empty' => 'Yakamara\YForm\Validate\IsEmpty',
+ 'rex_yform_validate_in_names' => 'Yakamara\YForm\Validate\InNames',
+ 'rex_yform_validate_in_table' => 'Yakamara\YForm\Validate\InTable',
+ 'rex_yform_validate_intfromto' => 'Yakamara\YForm\Validate\IntFromTo',
+ 'rex_yform_validate_password_policy' => 'Yakamara\YForm\Validate\PasswordPolicy',
+ 'rex_yform_validate_preg_match' => 'Yakamara\YForm\Validate\PregMatch',
+ 'rex_yform_validate_size_range' => 'Yakamara\YForm\Validate\SizeRange',
+ 'rex_yform_validate_size' => 'Yakamara\YForm\Validate\Size',
+ 'rex_yform_validate_type' => 'Yakamara\YForm\Validate\Type',
+ 'rex_yform_validate_unique' => 'Yakamara\YForm\Validate\Unique',
+
+ 'rex_yform_value_abstract' => 'Yakamara\YForm\Value\AbstractValue',
+ 'rex_yform_value_article' => 'Yakamara\YForm\Value\Article',
+ 'rex_yform_value_be_link' => 'Yakamara\YForm\Value\BackendLink',
+ 'rex_yform_value_be_manager_relation' => 'Yakamara\YForm\Value\BackendManagerRelation',
+ 'rex_yform_value_be_media' => 'Yakamara\YForm\Value\BackendMedia',
+ 'rex_yform_value_be_table' => 'Yakamara\YForm\Value\BackendTable',
+ 'rex_yform_value_be_user' => 'Yakamara\YForm\Value\BackendUser',
+ 'rex_yform_value_checkbox' => 'Yakamara\YForm\Value\Checkbox',
+ 'rex_yform_value_choice' => 'Yakamara\YForm\Value\Choice',
+ 'rex_yform_value_csrf' => 'Yakamara\YForm\Value\Csrf',
+ 'rex_yform_value_date' => 'Yakamara\YForm\Value\Date',
+ 'rex_yform_value_datestamp' => 'Yakamara\YForm\Value\DateStamp',
+ 'rex_yform_value_datetime' => 'Yakamara\YForm\Value\DateTime',
+ 'rex_yform_value_email' => 'Yakamara\YForm\Value\Email',
+ 'rex_yform_value_emptyname' => 'Yakamara\YForm\Value\EmptyName',
+ 'rex_yform_value_fieldset' => 'Yakamara\YForm\Value\Fieldset',
+ 'rex_yform_value_generate_key' => 'Yakamara\YForm\Value\GenerateKey',
+ 'rex_yform_value_google_geocode' => 'Yakamara\YForm\Value\GoogleGeoCode',
+ 'rex_yform_value_hashvalue' => 'Yakamara\YForm\Value\HashValue',
+ 'rex_yform_value_hidden' => 'Yakamara\YForm\Value\Hidden',
+ 'rex_yform_value_html' => 'Yakamara\YForm\Value\Html',
+ 'rex_yform_value_index' => 'Yakamara\YForm\Value\Index',
+ 'rex_yform_value_integer' => 'Yakamara\YForm\Value\Integer',
+ 'rex_yform_value_ip' => 'Yakamara\YForm\Value\IP',
+ 'rex_yform_value_number' => 'Yakamara\YForm\Value\Number',
+ 'rex_yform_value_objparams' => 'Yakamara\YForm\Value\ObjParams',
+ 'rex_yform_value_password' => 'Yakamara\YForm\Value\Password',
+ 'rex_yform_value_php' => 'Yakamara\YForm\Value\Php',
+ 'rex_yform_value_prio' => 'Yakamara\YForm\Value\Prio',
+ 'rex_yform_value_resetbutton' => 'Yakamara\YForm\Value\ResetButton',
+ 'rex_yform_value_showvalue' => 'Yakamara\YForm\Value\ShowValue',
+ 'rex_yform_value_signature' => 'Yakamara\YForm\Value\Signature',
+ 'rex_yform_value_submit' => 'Yakamara\YForm\Value\Submit',
+ 'rex_yform_value_text' => 'Yakamara\YForm\Value\Text',
+ 'rex_yform_value_textarea' => 'Yakamara\YForm\Value\Textarea',
+ 'rex_yform_value_time' => 'Yakamara\YForm\Value\Time',
+ 'rex_yform_value_upload' => 'Yakamara\YForm\Value\Upload',
+ 'rex_yform_value_uuid' => 'Yakamara\YForm\Value\Uuid',
+
],
)
->withConfiguredRule(FuncCallToStaticCallRector::class, [
diff --git a/ytemplates/bootstrap/value.article.tpl.php b/ytemplates/bootstrap/value.article.tpl.php
index f8d9027d3..fee01def0 100644
--- a/ytemplates/bootstrap/value.article.tpl.php
+++ b/ytemplates/bootstrap/value.article.tpl.php
@@ -1,11 +1,11 @@
getHTMLClass() . ' ' . $this->getWarningClass());
?>
diff --git a/ytemplates/bootstrap/value.be_link.tpl.php b/ytemplates/bootstrap/value.be_link.tpl.php
index b08d25bfc..c8f762e00 100644
--- a/ytemplates/bootstrap/value.be_link.tpl.php
+++ b/ytemplates/bootstrap/value.be_link.tpl.php
@@ -1,10 +1,8 @@
getRelationType()) {
- echo \Yakamara\YForm\RexVar\TableData::getRelationWidget($id, $this->getFieldName(), $this->getValue(), $link, $this->params['main_id']);
+ echo TableData::getRelationWidget($id, $this->getFieldName(), $this->getValue(), $link, $this->params['main_id']);
} elseif (2 == $this->getRelationType()) {
$name = $this->getFieldName();
$args = [];
$args['link'] = $link;
$args['fieldName'] = $this->getRelationSourceTableName() . '.' . $this->getName();
$args['valueName'] = $valueName;
- $_csrf_key = \Yakamara\YForm\Manager\Table\Table::get($this->relation['target_table'])->getCSRFKey();
+ $_csrf_key = Table::get($this->relation['target_table'])->getCSRFKey();
$args += rex_csrf_token::factory($_csrf_key)->getUrlParams();
$value = implode(',', $this->getValue());
- echo \Yakamara\YForm\RexVar\TableData::getSingleWidget($id, $name, $value, $args);
+ echo TableData::getSingleWidget($id, $name, $value, $args);
} else {
$name = $this->getFieldName();
$args = [];
@@ -83,10 +83,10 @@
$args['fieldName'] = $this->getRelationSourceTableName() . '.' . $this->getName();
$args['size'] = $this->getRelationSize();
$args['attributes'] = $this->getAttributeArray([], ['required', 'readonly']);
- $_csrf_key = \Yakamara\YForm\Manager\Table\Table::get($this->relation['target_table'])->getCSRFKey();
+ $_csrf_key = Table::get($this->relation['target_table'])->getCSRFKey();
$args += rex_csrf_token::factory($_csrf_key)->getUrlParams();
$value = implode(',', $this->getValue());
- echo \Yakamara\YForm\RexVar\TableData::getMultipleWidget($id, $name, $value, $args);
+ echo TableData::getMultipleWidget($id, $name, $value, $args);
}
?>
= $notice ?>
diff --git a/ytemplates/bootstrap/value.be_media.tpl.php b/ytemplates/bootstrap/value.be_media.tpl.php
index d559b85a0..dd44d73f3 100644
--- a/ytemplates/bootstrap/value.be_media.tpl.php
+++ b/ytemplates/bootstrap/value.be_media.tpl.php
@@ -1,10 +1,8 @@
params['form_output'] = [];
$field->params['this']->setObjectparams('form_name', $this->getParam('form_name') . '][' . $this->getId() . '][' . $i);
diff --git a/ytemplates/bootstrap/value.be_table.tpl.php b/ytemplates/bootstrap/value.be_table.tpl.php
index 8b488f7ee..3813dbccd 100644
--- a/ytemplates/bootstrap/value.be_table.tpl.php
+++ b/ytemplates/bootstrap/value.be_table.tpl.php
@@ -1,10 +1,9 @@
params['form_output'] = [];
$field->params['this']->setObjectparams('form_name', $this->getParam('form_name') . '][' . $this->getId() . '][' . $data_index);
diff --git a/ytemplates/bootstrap/value.checkbox.tpl.php b/ytemplates/bootstrap/value.checkbox.tpl.php
index 29ca2195a..1133fec41 100644
--- a/ytemplates/bootstrap/value.checkbox.tpl.php
+++ b/ytemplates/bootstrap/value.checkbox.tpl.php
@@ -1,10 +1,8 @@
getValue() ?? '';
$notices = [];
diff --git a/ytemplates/bootstrap/value.checkbox_group.tpl.php b/ytemplates/bootstrap/value.checkbox_group.tpl.php
index 7ad007324..83b14b970 100644
--- a/ytemplates/bootstrap/value.checkbox_group.tpl.php
+++ b/ytemplates/bootstrap/value.checkbox_group.tpl.php
@@ -1,10 +1,8 @@
getValue() ?? '';
diff --git a/ytemplates/bootstrap/value.hidden.tpl.php b/ytemplates/bootstrap/value.hidden.tpl.php
index 85339bc24..a4e234b83 100644
--- a/ytemplates/bootstrap/value.hidden.tpl.php
+++ b/ytemplates/bootstrap/value.hidden.tpl.php
@@ -1,8 +1,7 @@
diff --git a/ytemplates/bootstrap/value.radio.tpl.php b/ytemplates/bootstrap/value.radio.tpl.php
index a70088298..72606a159 100644
--- a/ytemplates/bootstrap/value.radio.tpl.php
+++ b/ytemplates/bootstrap/value.radio.tpl.php
@@ -1,10 +1,8 @@
diff --git a/ytemplates/bootstrap/value.select.tpl.php b/ytemplates/bootstrap/value.select.tpl.php
index ccc0cee66..77b6a77a0 100644
--- a/ytemplates/bootstrap/value.select.tpl.php
+++ b/ytemplates/bootstrap/value.select.tpl.php
@@ -1,10 +1,8 @@
getElement('notice')) {
$notice[] = rex_i18n::translate($this->getElement('notice'), false);
diff --git a/ytemplates/bootstrap/value.signature.tpl.php b/ytemplates/bootstrap/value.signature.tpl.php
index 584392b35..3e901d2d6 100644
--- a/ytemplates/bootstrap/value.signature.tpl.php
+++ b/ytemplates/bootstrap/value.signature.tpl.php
@@ -1,10 +1,8 @@
getValue();
$notice = [];
diff --git a/ytemplates/bootstrap/value.submit.tpl.php b/ytemplates/bootstrap/value.submit.tpl.php
index 71cbaa103..45fb785de 100644
--- a/ytemplates/bootstrap/value.submit.tpl.php
+++ b/ytemplates/bootstrap/value.submit.tpl.php
@@ -1,10 +1,8 @@
getElement('notice')) {
$notice[] = rex_i18n::translate($this->getElement('notice'), false);
diff --git a/ytemplates/bootstrap/value.upload.tpl.php b/ytemplates/bootstrap/value.upload.tpl.php
index d0400e855..c3a91ea20 100644
--- a/ytemplates/bootstrap/value.upload.tpl.php
+++ b/ytemplates/bootstrap/value.upload.tpl.php
@@ -1,10 +1,8 @@
getValue() ?? '';
$options ??= [];
$download_link ??= '';