Issue #3048698 by Sam152, alexpott, tedbow, fenstrat: Content moderation layout builder integration fails when a node has an associated menu item
parent
11228d4be9
commit
e07c22588a
|
@ -23,6 +23,7 @@ class LayoutBuilderContentModerationIntegrationTest extends BrowserTestBase {
|
|||
'layout_builder',
|
||||
'node',
|
||||
'content_moderation',
|
||||
'menu_ui',
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -76,6 +77,12 @@ class LayoutBuilderContentModerationIntegrationTest extends BrowserTestBase {
|
|||
],
|
||||
],
|
||||
]);
|
||||
_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;
|
||||
|
|
Loading…
Reference in New Issue