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

Issue #3475233 Wrong title

Get the menu link from node from form input.
Only if menulink is not enabled (also put the code to enable menulink in the condition)
parent 7ae0c349
No related branches found
No related tags found
No related merge requests found
......@@ -230,9 +230,13 @@ function _menu_link_sync_override_form_values(FormStateInterface $form_state, ar
$input['field_menulink'][0]['weight'] = $values['weight'];
}
// Set the "Create a menu link" checkbox to "enabled".
$form_state->setValue(['field_menulink', 0, 'enabled'], 1);
$input['field_menulink'][0]['enabled'] = 1;
if ($form_state->getValue(['field_menulink', 0, 'enabled']) !== 1) {
$form_state->setValue(['field_menulink', 0, 'title'], $values['title']);
$input["field_menulink"][0]["title"] = $values['title'];
// Set the "Create a menu link" checkbox to "enabled".
$form_state->setValue(['field_menulink', 0, 'enabled'], 1);
$input['field_menulink'][0]['enabled'] = 1;
}
$form_state->setUserInput($input);
}
......
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