Commit e07c2258 authored by alexpott's avatar alexpott

Issue #3048698 by Sam152, alexpott, tedbow, fenstrat: Content moderation...

Issue #3048698 by Sam152, alexpott, tedbow, fenstrat: Content moderation layout builder integration fails when a node has an associated menu item
parent 11228d4b
......@@ -23,6 +23,7 @@ class LayoutBuilderContentModerationIntegrationTest extends BrowserTestBase {
'layout_builder',
'node',
'content_moderation',
'menu_ui',
];
/**
......@@ -76,6 +77,12 @@ public function testLayoutModeration() {
],
],
]);
_menu_ui_node_save($node, [
'title' => 'bar',
'menu_name' => 'main',
'description' => 'view bar',
'parent' => '',
]);
$this->drupalGet($node->toUrl());
// Publish the node. Revision count: 2.
......
......@@ -16,9 +16,15 @@ class MenuSettingsConstraintValidator extends ConstraintValidator {
public function validate($entity, Constraint $constraint) {
if (isset($entity) && !$entity->isNew() && !$entity->isDefaultRevision()) {
$defaults = menu_ui_get_menu_link_defaults($entity);
$values = $entity->menu;
$violation_path = NULL;
// If the menu UI entity builder is not present and the menu property has
// not been set, do not attempt to validate the menu settings since they
// are not being modified.
if (!$values = $entity->menu) {
return;
}
if (trim($values['title']) && !empty($values['menu_parent'])) {
list($menu_name, $parent) = explode(':', $values['menu_parent'], 2);
$values['menu_name'] = $menu_name;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment