Skip to content

Commit

Permalink
Stop showing the Set Status action based on hasStatuses()
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Nov 21, 2022
1 parent 0df6fcc commit ce9ca33
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 15 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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))
Expand Down
4 changes: 1 addition & 3 deletions src/base/Element.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand All @@ -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.
*
Expand Down
12 changes: 8 additions & 4 deletions src/elements/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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';
Expand Down Expand Up @@ -299,6 +295,14 @@ protected static function defineActions(string $source): array
return $actions;
}

/**
* @inheritdoc
*/
protected static function includeSetStatusAction(): bool
{
return true;
}

/**
* @inheritdoc
*/
Expand Down
8 changes: 8 additions & 0 deletions src/elements/Entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,14 @@ protected static function defineActions(string $source): array
return $actions;
}

/**
* @inheritdoc
*/
protected static function includeSetStatusAction(): bool
{
return true;
}

/**
* @inheritdoc
*/
Expand Down
8 changes: 0 additions & 8 deletions src/elements/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,14 +310,6 @@ protected static function defineSources(string $context): array
return $sources;
}

/**
* @inheritdoc
*/
protected static function includeSetStatusAction(): bool
{
return false;
}

/**
* @inheritdoc
*/
Expand Down

0 comments on commit ce9ca33

Please sign in to comment.