Skip to content
Snippets Groups Projects
Commit 961fb07f authored by Yves Guide's avatar Yves Guide
Browse files

Issue #3475737:

Provide a message to the user when source have a <nolink> has parent
parent 0bd2e22d
No related branches found
No related tags found
No related merge requests found
......@@ -151,6 +151,19 @@ function menu_link_sync_process_menu_form($element, FormStateInterface $form_sta
/** @var \Drupal\Core\Menu\MenuLinkManagerInterface $menu_link_manager */
$menu_link_manager = \Drupal::service('plugin.manager.menu.link');
$parent = $translation_source_link->parent;
// Check if parent have a <nolink>
if( $parent && is_string($parent) && explode(':', $parent)[0] == 'menu_link_content' ) {
$menu_link = \Drupal::service('plugin.manager.menu.link')
->createInstance($parent);
if( $menu_link->getUrlObject()->getRouteName() == '<nolink>'){
$element['messages']['#prefix'] = '<div class="messages status">'.
t('It\'s not possible to sync menu items when parent of translation source is a <nolink> item.').
'</div>';
return $element;
}
}
if ($parent) {
$link = _menu_link_sync_get_link_for_target_language($parent, $target_language);
if ($link && $link->menu_name) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment