Skip to content

Commit

Permalink
Merge pull request #14219 from craftcms/bugfix/check-field-layout-ele…
Browse files Browse the repository at this point in the history
…ments-againt-plugins

check if field layout element belongs to an enabled plugin
  • Loading branch information
brandonkelly authored Jan 29, 2024
2 parents 31d93f6 + 54220f9 commit 2780a61
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
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

0 comments on commit 2780a61

Please sign in to comment.