diff --git a/.tools/psalm/baseline.xml b/.tools/psalm/baseline.xml index 6bbb488fd0..093807b82c 100644 --- a/.tools/psalm/baseline.xml +++ b/.tools/psalm/baseline.xml @@ -2076,25 +2076,6 @@ - - - sql->getValue('link' . $index)]]> - sql->getValue('linklist' . $index)]]> - sql->getValue('media' . $index)]]> - sql->getValue('medialist' . $index)]]> - sql->getValue('value' . $index)]]> - - - - - - - - - - - - @@ -2224,6 +2205,25 @@ + + + sql->getValue('link' . $index)]]> + sql->getValue('linklist' . $index)]]> + sql->getValue('media' . $index)]]> + sql->getValue('medialist' . $index)]]> + sql->getValue('value' . $index)]]> + + + + + + + + + + + + diff --git a/.tools/visual-tests/screenshots/modules_actions_add--dark.png b/.tools/visual-tests/screenshots/modules_actions_add--dark.png index 715d16b3dc..629a87e0da 100644 Binary files a/.tools/visual-tests/screenshots/modules_actions_add--dark.png and b/.tools/visual-tests/screenshots/modules_actions_add--dark.png differ diff --git a/.tools/visual-tests/screenshots/modules_actions_add.png b/.tools/visual-tests/screenshots/modules_actions_add.png index 0a778b854a..e88297a449 100644 Binary files a/.tools/visual-tests/screenshots/modules_actions_add.png and b/.tools/visual-tests/screenshots/modules_actions_add.png differ diff --git a/pages/module/actions.php b/pages/module/actions.php index ce38d436ee..48cbadf067 100644 --- a/pages/module/actions.php +++ b/pages/module/actions.php @@ -258,7 +258,7 @@ $n = []; $n['label'] = ''; $n['field'] = ''; - $n['note'] = I18n::msg('action_hint', 'ArticleAction $this'); + $n['note'] = I18n::msg('action_hint', 'ArticleSliceAction $this'); $formElements[] = $n; $fragment = new Fragment(); @@ -300,7 +300,7 @@ $n = []; $n['label'] = ''; $n['field'] = ''; - $n['note'] = I18n::msg('action_hint', 'ArticleAction $this'); + $n['note'] = I18n::msg('action_hint', 'ArticleSliceAction $this'); $formElements[] = $n; $fragment = new Fragment(); @@ -342,7 +342,7 @@ $n = []; $n['label'] = ''; $n['field'] = ''; - $n['note'] = I18n::msg('action_hint', 'ArticleAction $this'); + $n['note'] = I18n::msg('action_hint', 'ArticleSliceAction $this'); $formElements[] = $n; $fragment = new Fragment(); diff --git a/pages/structure/content.php b/pages/structure/content.php index d0bbb2064f..1151b0407a 100644 --- a/pages/structure/content.php +++ b/pages/structure/content.php @@ -5,9 +5,9 @@ use Redaxo\Core\Backend\Navigation; use Redaxo\Core\Backend\Page; use Redaxo\Core\Content\Article; -use Redaxo\Core\Content\ArticleAction; use Redaxo\Core\Content\ArticleCache; use Redaxo\Core\Content\ArticleSlice; +use Redaxo\Core\Content\ArticleSliceAction; use Redaxo\Core\Content\ContentHandler; use Redaxo\Core\Content\ExtensionPoint\ArticleContentUpdated; use Redaxo\Core\Content\Template; @@ -165,9 +165,9 @@ // $newsql->setDebug(); // ----- PRE SAVE ACTION [ADD/EDIT/DELETE] - $action = new ArticleAction($moduleId, $function, $newsql); + $action = new ArticleSliceAction($moduleId, $function, $newsql); $action->setRequestValues(); - $action->exec(ArticleAction::PRESAVE); + $action->exec(ArticleSliceAction::PRESAVE); $actionMessage = implode('
', $action->messages); // ----- / PRE SAVE ACTION @@ -186,7 +186,7 @@ $actionMessage .= '
'; } - // clone sql object to preserve values in sql object given to ArticleAction + // clone sql object to preserve values in sql object given to ArticleSliceAction // otherwise the POSTSAVE action did not have access to values $newsql = clone $newsql; @@ -325,7 +325,7 @@ ])); // ----- POST SAVE ACTION [ADD/EDIT/DELETE] - $action->exec(ArticleAction::POSTSAVE); + $action->exec(ArticleSliceAction::POSTSAVE); if ($messages = $action->messages) { $info .= '
' . implode('
', $messages); } diff --git a/rector.php b/rector.php index cb86b29d5b..c48ba7ac5a 100644 --- a/rector.php +++ b/rector.php @@ -346,7 +346,7 @@ 'rex_var_medialist' => RexVar\MediaListVar::class, 'rex_version' => Util\Version::class, 'rex_article' => Content\Article::class, - 'rex_article_action' => Content\ArticleAction::class, + 'rex_article_action' => Content\ArticleSliceAction::class, 'rex_article_cache' => Content\ArticleCache::class, 'rex_article_content' => Content\ArticleContent::class, 'rex_article_content_base' => Content\ArticleContentBase::class, @@ -519,9 +519,9 @@ new MethodCallToPropertyFetch(Content\ArticleSlice::class, 'getRevision', 'revision'), new MethodCallToPropertyFetch(Content\ArticleSlice::class, 'getPriority', 'priority'), - new MethodCallToPropertyFetch(Content\ArticleAction::class, 'getEvent', 'event'), - new MethodCallToPropertyFetch(Content\ArticleAction::class, 'getSave', 'save'), // todo setter - new MethodCallToPropertyFetch(Content\ArticleAction::class, 'getMessages', 'messages'), + new MethodCallToPropertyFetch(Content\ArticleSliceAction::class, 'getEvent', 'event'), + new MethodCallToPropertyFetch(Content\ArticleSliceAction::class, 'getSave', 'save'), // todo setter + new MethodCallToPropertyFetch(Content\ArticleSliceAction::class, 'getMessages', 'messages'), new MethodCallToPropertyFetch(Content\ContentSection::class, 'getId', 'id'), new MethodCallToPropertyFetch(Content\ContentSection::class, 'getName', 'name'), diff --git a/src/Content/ArticleContentEditor.php b/src/Content/ArticleContentEditor.php index 43b754e1e4..5b41b6b942 100644 --- a/src/Content/ArticleContentEditor.php +++ b/src/Content/ArticleContentEditor.php @@ -90,11 +90,11 @@ protected function outputSlice(Sql $artDataSql, $moduleIdToAdd) // **************** Aktueller Slice // ----- PRE VIEW ACTION [EDIT] - $action = new ArticleAction($moduleId, 'edit', $artDataSql); + $action = new ArticleSliceAction($moduleId, 'edit', $artDataSql); if ('post' == Request::requestMethod() && 'edit' == Request::request('function', 'string')) { $action->setRequestValues(); } - $action->exec(ArticleAction::PREVIEW); + $action->exec(ArticleSliceAction::PREVIEW); // ----- / PRE VIEW ACTION return $sliceContent . $this->editSlice($sliceId, $moduleInput, $sliceCtype, $moduleId, $artDataSql); @@ -438,9 +438,9 @@ protected function addSlice($sliceId, $moduleId) ->setValue('ctype_id', $this->ctype); // ----- PRE VIEW ACTION [ADD] - $action = new ArticleAction($moduleId, 'add', $initDataSql); + $action = new ArticleSliceAction($moduleId, 'add', $initDataSql); $action->setRequestValues(); - $action->exec(ArticleAction::PREVIEW); + $action->exec(ArticleSliceAction::PREVIEW); // ----- / PRE VIEW ACTION $this->currentSlice = ArticleSlice::forNewSlice($this->article_id, $this->clang, $this->ctype, $moduleId, $this->sliceAddPosition, $this->slice_revision); diff --git a/src/Content/ArticleAction.php b/src/Content/ArticleSliceAction.php similarity index 98% rename from src/Content/ArticleAction.php rename to src/Content/ArticleSliceAction.php index 80fe8356ff..3f515da6ec 100644 --- a/src/Content/ArticleAction.php +++ b/src/Content/ArticleSliceAction.php @@ -11,7 +11,7 @@ use function in_array; use function is_array; -final class ArticleAction +final class ArticleSliceAction { public const int ADD = 1; public const int EDIT = 2; @@ -78,7 +78,7 @@ public function setRequestValues(): void public function exec(string $type): void { if (!in_array($type, [self::PREVIEW, self::PRESAVE, self::POSTSAVE])) { - throw new InvalidArgumentException('$type must be ArticleAction::PREVIEW, ::PRESAVE or ::POSTSAVE.'); + throw new InvalidArgumentException('$type must be ArticleSliceAction::PREVIEW, ::PRESAVE or ::POSTSAVE.'); } $this->messages = [];