diff --git a/core/modules/menu/menu.module b/core/modules/menu/menu.module index 7e26d50..f4c2a90 100644 --- a/core/modules/menu/menu.module +++ b/core/modules/menu/menu.module @@ -566,6 +566,13 @@ function menu_form_node_form_alter(&$form, $form_state) { $node = $form_state['controller']->getEntity($form_state); $link = $node->menu; $type = $node->type; + // In case we're in preview and there is no mlid yet but a title + // has been supplied, trick the menu form to store it's information. + if (!empty($node->in_preview) && empty($link['mlid']) && !empty($link['link_title'])) { + $link['mlid'] = TRUE; + // @todo move all other properties to attributes as well ? + $link['options']['attributes']['title'] = $link['description']; + } // menu_parent_options() is goofy and can actually handle either a menu link // or a node type both as second argument. Pick based on whether there is // a link already (menu_node_prepare() sets mlid default to 0). diff --git a/core/modules/node/lib/Drupal/node/NodeFormController.php b/core/modules/node/lib/Drupal/node/NodeFormController.php index baed0f3..8af21e4 100644 --- a/core/modules/node/lib/Drupal/node/NodeFormController.php +++ b/core/modules/node/lib/Drupal/node/NodeFormController.php @@ -86,6 +86,7 @@ public function form(array $form, array &$form_state, EntityInterface $node) { $tempstore_id = drupal_container()->get('request')->query->get('tempstore_id'); if (!empty($tempstore_id) && ($data = node_tempstore_load($tempstore_id))) { $node = $data; + $form_state['entity'] = $node; // Restore the destination if we previewed the node. if (isset($node->destination)) { diff --git a/core/modules/path/path.module b/core/modules/path/path.module index 7521dee..654460c 100644 --- a/core/modules/path/path.module +++ b/core/modules/path/path.module @@ -102,7 +102,10 @@ function path_menu() { function path_form_node_form_alter(&$form, $form_state) { $node = $form_state['controller']->getEntity($form_state); $path = array(); - if (!empty($node->nid)) { + if (!empty($node->in_preview) && !empty($node->path['alias'])) { + $path = $node->path; + } + elseif (!empty($node->nid)) { $conditions = array('source' => 'node/' . $node->nid); if ($node->langcode != LANGUAGE_NOT_SPECIFIED) { $conditions['langcode'] = $node->langcode;