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

Show the site menu in the “Related To” condition rule modal. #16036

Merged
merged 5 commits into from
Nov 7, 2024
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
4 changes: 3 additions & 1 deletion CHANGELOG-WIP.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
- Pressing <kbd>Return</kbd> when an inline-editable field is focused now submits the inline form. (Previously <kbd>Ctrl</kbd>/<kbd>Command</kbd> had to be pressed as well.) ([#15841](https://github.com/craftcms/cms/issues/15841))
- Improved the styling of element edit page headers, for elements with long titles. ([#16001](https://github.com/craftcms/cms/pull/16001))
- It’s now possible to preview audio and video assets from Edit Asset screens. ([#16021](https://github.com/craftcms/cms/pull/16021))
- Sidebar visibility states are now stored in a browser cookie, so they are retained between page/slideout loads. ([#16025](https://github.com/craftcms/cms/pull/16025), [#15982](https://github.com/craftcms/cms/discussions/15982))
- Sidebar visibility states are now stored in a browser cookie, so they are retained between page/slideout loads. ([#16025](https://github.com/craftcms/cms/pull/16025), [#15982](https://github.com/craftcms/cms/discussions/15982))
- “Related To” condition rules now show the site menu in element selector modals. ([#16036](https://github.com/craftcms/cms/pull/16036))

### Accessibility
- Improved the control panel for screen readers. ([#15665](https://github.com/craftcms/cms/pull/15665))
Expand Down Expand Up @@ -61,6 +62,7 @@
- Added `craft\base\NestedElementTrait::saveOwnership()`. ([#15894](https://github.com/craftcms/cms/pull/15894))
- Added `craft\base\PreviewableFieldInterface::previewPlaceholderHtml()`.
- Added `craft\base\RequestTrait::getIsWebRequest()`. ([#15690](https://github.com/craftcms/cms/pull/15690))
- Added `craft\base\conditions\BaseElementSelectConditionRule::elementSelectConfig()`.
- Added `craft\console\Controller::output()`.
- Added `craft\console\controllers\ResaveController::hasTheFields()`.
- Added `craft\elements\db\NestedElementQueryTrait`. ([#15894](https://github.com/craftcms/cms/pull/15894))
Expand Down
32 changes: 21 additions & 11 deletions src/base/conditions/BaseElementSelectConditionRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,26 @@ protected function criteria(): ?array
return null;
}

/**
* Defines the element select config.
*
* @return array
* @since 5.5.0
*/
protected function elementSelectConfig(): array
{
$element = $this->_element();
return [
'name' => 'elementId',
'elements' => $element ? [$element] : [],
'elementType' => $this->elementType(),
'sources' => $this->sources(),
'criteria' => $this->criteria(),
'condition' => $this->selectionCondition(),
'single' => true,
];
}

/**
* @param bool $parse Whether to parse the value for an environment variable
* @return int|string|null
Expand Down Expand Up @@ -125,17 +145,7 @@ protected function inputHtml(): string
]);
}

$element = $this->_element();

return Cp::elementSelectHtml([
'name' => 'elementId',
'elements' => $element ? [$element] : [],
'elementType' => $this->elementType(),
'sources' => $this->sources(),
'criteria' => $this->criteria(),
'condition' => $this->selectionCondition(),
'single' => true,
]);
return Cp::elementSelectHtml($this->elementSelectConfig());
}

/**
Expand Down
10 changes: 10 additions & 0 deletions src/elements/conditions/RelatedToConditionRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ public function getExclusiveQueryParams(): array
return [];
}

/**
* @inerhitdoc
*/
protected function elementSelectConfig(): array
{
return array_merge(parent::elementSelectConfig(), [
'showSiteMenu' => true,
]);
}

/**
* @inheritdoc
*/
Expand Down
Loading