Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only localized element types should get the site condition rule #12601

Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Fixed a bug where clicking on the scrollbar of a disclosure menu would close it. ([#12681](https://github.com/craftcms/cms/issues/12681))
- Fixed a bug where large asset thumbnails weren’t centered within Assets fields. ([#12682](https://github.com/craftcms/cms/issues/12682))
- Fixed a PHP error that could occur when versioning asset URLs. ([#12678](https://github.com/craftcms/cms/issues/12678))
- Fixed a bug where the “Site” element condition rule was available for non-localizable element types’ conditions. ([#12601](https://github.com/craftcms/cms/pull/12601))

## 4.3.9 - 2023-02-14

Expand Down
12 changes: 6 additions & 6 deletions src/elements/conditions/ElementCondition.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ protected function conditionRuleTypes(): array
SlugConditionRule::class,
];

if (Craft::$app->getIsMultiSite()) {
/** @var string|ElementInterface|null $elementType */
/** @phpstan-var class-string<ElementInterface>|ElementInterface|null $elementType */
$elementType = $this->elementType;

if (Craft::$app->getIsMultiSite() && (!$elementType || $elementType::isLocalized())) {
$types[] = SiteConditionRule::class;
}

if ($this->elementType !== null) {
/** @var string|ElementInterface $elementType */
/** @phpstan-var class-string<ElementInterface>|ElementInterface $elementType */
$elementType = $this->elementType;

if ($elementType !== null) {
if ($elementType::hasUris()) {
$types[] = HasUrlConditionRule::class;
$types[] = UriConditionRule::class;
Expand Down