Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions .tools/psalm/baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2076,25 +2076,6 @@
<code><![CDATA[Core::getProperty('start_article_id', 1)]]></code>
</NullableReturnStatement>
</file>
<file src="src/Content/ArticleAction.php">
<LessSpecificReturnStatement>
<code><![CDATA[$this->sql->getValue('link' . $index)]]></code>
<code><![CDATA[$this->sql->getValue('linklist' . $index)]]></code>
<code><![CDATA[$this->sql->getValue('media' . $index)]]></code>
<code><![CDATA[$this->sql->getValue('medialist' . $index)]]></code>
<code><![CDATA[$this->sql->getValue('value' . $index)]]></code>
</LessSpecificReturnStatement>
<MixedArgument>
<code><![CDATA[$values[$i]]]></code>
</MixedArgument>
<MoreSpecificReturnType>
<code><![CDATA[?int]]></code>
<code><![CDATA[?string]]></code>
<code><![CDATA[?string]]></code>
<code><![CDATA[?string]]></code>
<code><![CDATA[?string]]></code>
</MoreSpecificReturnType>
</file>
<file src="src/Content/ArticleCache.php">
<InvalidOperand>
<code><![CDATA[$clang]]></code>
Expand Down Expand Up @@ -2224,6 +2205,25 @@
<code><![CDATA[$data['value']]]></code>
</PossiblyUndefinedArrayOffset>
</file>
<file src="src/Content/ArticleSliceAction.php">
<LessSpecificReturnStatement>
<code><![CDATA[$this->sql->getValue('link' . $index)]]></code>
<code><![CDATA[$this->sql->getValue('linklist' . $index)]]></code>
<code><![CDATA[$this->sql->getValue('media' . $index)]]></code>
<code><![CDATA[$this->sql->getValue('medialist' . $index)]]></code>
<code><![CDATA[$this->sql->getValue('value' . $index)]]></code>
</LessSpecificReturnStatement>
<MixedArgument>
<code><![CDATA[$values[$i]]]></code>
</MixedArgument>
<MoreSpecificReturnType>
<code><![CDATA[?int]]></code>
<code><![CDATA[?string]]></code>
<code><![CDATA[?string]]></code>
<code><![CDATA[?string]]></code>
<code><![CDATA[?string]]></code>
</MoreSpecificReturnType>
</file>
<file src="src/Content/CategoryHandler.php">
<ArgumentTypeCoercion>
<code><![CDATA[$id]]></code>
Expand Down
Binary file modified .tools/visual-tests/screenshots/modules_actions_add--dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .tools/visual-tests/screenshots/modules_actions_add.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions pages/module/actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@
$n = [];
$n['label'] = '<label for="previewaction">' . I18n::msg('input') . '</label>';
$n['field'] = '<textarea class="form-control rex-code rex-js-code" name="previewaction" id="previewaction" autocapitalize="off" autocorrect="off" spellcheck="false">' . escape($previewaction) . '</textarea>';
$n['note'] = I18n::msg('action_hint', '<var>ArticleAction $this</var>');
$n['note'] = I18n::msg('action_hint', '<var>ArticleSliceAction $this</var>');
$formElements[] = $n;

$fragment = new Fragment();
Expand Down Expand Up @@ -300,7 +300,7 @@
$n = [];
$n['label'] = '<label for="presaveaction">' . I18n::msg('input') . '</label>';
$n['field'] = '<textarea class="form-control rex-code rex-js-code" name="presaveaction" id="presaveaction" autocapitalize="off" autocorrect="off" spellcheck="false">' . escape($presaveaction) . '</textarea>';
$n['note'] = I18n::msg('action_hint', '<var>ArticleAction $this</var>');
$n['note'] = I18n::msg('action_hint', '<var>ArticleSliceAction $this</var>');
$formElements[] = $n;

$fragment = new Fragment();
Expand Down Expand Up @@ -342,7 +342,7 @@
$n = [];
$n['label'] = '<label for="postsaveaction">' . I18n::msg('input') . '</label>';
$n['field'] = '<textarea class="form-control rex-code rex-js-code" name="postsaveaction" id="postsaveaction" autocapitalize="off" autocorrect="off" spellcheck="false">' . escape($postsaveaction) . '</textarea>';
$n['note'] = I18n::msg('action_hint', '<var>ArticleAction $this</var>');
$n['note'] = I18n::msg('action_hint', '<var>ArticleSliceAction $this</var>');
$formElements[] = $n;

$fragment = new Fragment();
Expand Down
10 changes: 5 additions & 5 deletions pages/structure/content.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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('<br />', $action->messages);
// ----- / PRE SAVE ACTION

Expand All @@ -186,7 +186,7 @@
$actionMessage .= '<br />';
}

// 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;

Expand Down Expand Up @@ -325,7 +325,7 @@
]));

// ----- POST SAVE ACTION [ADD/EDIT/DELETE]
$action->exec(ArticleAction::POSTSAVE);
$action->exec(ArticleSliceAction::POSTSAVE);
if ($messages = $action->messages) {
$info .= '<br />' . implode('<br />', $messages);
}
Expand Down
8 changes: 4 additions & 4 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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'),
Expand Down
8 changes: 4 additions & 4 deletions src/Content/ArticleContentEditor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 = [];
Expand Down
Loading