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

check if field layout element belongs to an enabled plugin #14219

Merged
merged 3 commits into from
Jan 29, 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
1 change: 1 addition & 0 deletions CHANGELOG-WIP.md
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@
- Slugs are no longer required for elements that don’t have a URI format that contains `slug`.
- Fixed a bug where multi-site element queries weren’t scoring elements on a per-site basis. ([#13801](https://github.com/craftcms/cms/discussions/13801))
- Fixed an error that could occur if eager-loading aliases conflicted with native eager-loading handles, such as `author`. ([#14057](https://github.com/craftcms/cms/issues/14057))
- Fixed a bug where layout components provided by disabled plugins weren’t getting omitted. ([#14219](https://github.com/craftcms/cms/pull/14219))
- Added an SVG icon set based on Font Awesome 6.5.1. ([#14169](https://github.com/craftcms/cms/pull/14169))
- Updated Monolog to v3.
- Updated Axios to 1.6.5.
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
- Fixed an error that could occur when field handles were overridden. ([#14166](https://github.com/craftcms/cms/issues/14166), [#14221](https://github.com/craftcms/cms/issues/14221))
- Fixed an error that occurred when adding a Dropdown field condition rule, if the field contained any optgroups. ([#14224](https://github.com/craftcms/cms/issues/14224))
- Fixed a bug where Dropdown field condition rules weren’t displaying `0` options. ([#14232](https://github.com/craftcms/cms/pull/14232))
- Fixed a bug where layout components provided by disabled plugins weren’t getting omitted. ([#14219](https://github.com/craftcms/cms/pull/14219))

## 5.0.0-alpha.8 - 2024-01-23

Expand Down
9 changes: 7 additions & 2 deletions src/models/FieldLayoutTab.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ public function getElements(): array
public function setElements(array $elements): void
{
$fieldsService = Craft::$app->getFields();
$pluginsService = Craft::$app->getPlugins();
$this->_elements = [];

foreach ($elements as $layoutElement) {
Expand All @@ -263,8 +264,12 @@ public function setElements(array $elements): void
}
}

$layoutElement->setLayout($this->getLayout());
$this->_elements[] = $layoutElement;
// if layout element belongs to a plugin, ensure the plugin is installed
$pluginHandle = $pluginsService->getPluginHandleByClass($layoutElement::class);
if ($pluginHandle === null || $pluginsService->isPluginEnabled($pluginHandle)) {
$layoutElement->setLayout($this->getLayout());
$this->_elements[] = $layoutElement;
}
}
}

Expand Down