diff --git a/CHANGELOG.md b/CHANGELOG.md index b5f600d19e7..afcd238af83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Release Notes for Craft CMS 4 +## Unreleased + +- `craft\base\Element::includeSetStatusAction()` now returns `false` by default regardless of what `hasStatuses()` returns, fixing a bug where some element indexes were unexpectedly getting “Set Status” actions. + ## 4.3.3 - 2022-11-17 - Fixed an error that occurred if an arrow function was passed to the `|sort` Twig filter. ([#12334](https://github.com/craftcms/cms/issues/12334)) diff --git a/src/base/Element.php b/src/base/Element.php index 278ad820cd6..0eb966d7183 100644 --- a/src/base/Element.php +++ b/src/base/Element.php @@ -948,7 +948,6 @@ public static function actions(string $source): array return $event->actions; } - /** * Returns whether the Set Status action should be included in [[actions()]] automatically. * @@ -957,10 +956,9 @@ public static function actions(string $source): array */ protected static function includeSetStatusAction(): bool { - return static::hasStatuses(); + return false; } - /** * Defines the available element actions for a given source. * diff --git a/src/elements/Category.php b/src/elements/Category.php index fbac935bc76..9586a11967e 100644 --- a/src/elements/Category.php +++ b/src/elements/Category.php @@ -17,7 +17,6 @@ use craft\elements\actions\Duplicate; use craft\elements\actions\NewChild; use craft\elements\actions\Restore; -use craft\elements\actions\SetStatus; use craft\elements\conditions\categories\CategoryCondition; use craft\elements\conditions\ElementConditionInterface; use craft\elements\db\CategoryQuery; @@ -254,9 +253,6 @@ protected static function defineActions(string $source): array $elementsService = Craft::$app->getElements(); if ($group) { - // Set Status - $actions[] = SetStatus::class; - // New Child if ($group->maxLevels != 1) { $newChildUrl = 'categories/' . $group->handle . '/new'; @@ -299,6 +295,14 @@ protected static function defineActions(string $source): array return $actions; } + /** + * @inheritdoc + */ + protected static function includeSetStatusAction(): bool + { + return true; + } + /** * @inheritdoc */ diff --git a/src/elements/Entry.php b/src/elements/Entry.php index 28bce3b3b7c..7d72e4caae1 100644 --- a/src/elements/Entry.php +++ b/src/elements/Entry.php @@ -426,6 +426,14 @@ protected static function defineActions(string $source): array return $actions; } + /** + * @inheritdoc + */ + protected static function includeSetStatusAction(): bool + { + return true; + } + /** * @inheritdoc */ diff --git a/src/elements/User.php b/src/elements/User.php index 736213b7aaa..4421c98358a 100644 --- a/src/elements/User.php +++ b/src/elements/User.php @@ -310,14 +310,6 @@ protected static function defineSources(string $context): array return $sources; } - /** - * @inheritdoc - */ - protected static function includeSetStatusAction(): bool - { - return false; - } - /** * @inheritdoc */