diff --git a/core/lib/Drupal/Core/Menu/Form/MenuLinkDefaultForm.php b/core/lib/Drupal/Core/Menu/Form/MenuLinkDefaultForm.php index ead546d..576c73b 100644 --- a/core/lib/Drupal/Core/Menu/Form/MenuLinkDefaultForm.php +++ b/core/lib/Drupal/Core/Menu/Form/MenuLinkDefaultForm.php @@ -184,10 +184,10 @@ public function submitConfigurationForm(array &$form, array &$form_state) { } /** - * Helper function to get a module name. + * Gets the name of the module. * * @param string $module - * A module machine name. + * The machine name of a module. * * @todo This function is horrible, but core has nothing better until we add a * a method to the ModuleHandler that handles this nicely. diff --git a/core/modules/menu_link_content/src/Entity/MenuLinkContent.php b/core/modules/menu_link_content/src/Entity/MenuLinkContent.php index 36600a6..f75f91c 100644 --- a/core/modules/menu_link_content/src/Entity/MenuLinkContent.php +++ b/core/modules/menu_link_content/src/Entity/MenuLinkContent.php @@ -347,7 +347,7 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { )) ->setDisplayOptions('form', array( 'type' => 'integer', - 'weight' => 0, + 'weight' => 20, )); $fields['expanded'] = FieldDefinition::create('boolean') @@ -364,9 +364,9 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { 'weight' => 0, )); - // @todo we manually create a form element for this, since the form logic is - // is inverted to show enabled. Flip this to a status field and use the - // normal entity boolen widget https://www.drupal.org/node/2305707 + // @todo We manually create a form element for this, since the form logic is + // is inverted to show enabled. Flip this to a status field and use the + // normal entity Boolean widget https://www.drupal.org/node/2305707 $fields['hidden'] = FieldDefinition::create('boolean') ->setLabel(t('Hidden')) ->setDescription(t('A flag for whether the link should be hidden in menus or rendered normally.')) diff --git a/core/modules/menu_link_content/src/Form/MenuLinkContentForm.php b/core/modules/menu_link_content/src/Form/MenuLinkContentForm.php index fd4479f..ae7e916 100644 --- a/core/modules/menu_link_content/src/Form/MenuLinkContentForm.php +++ b/core/modules/menu_link_content/src/Form/MenuLinkContentForm.php @@ -267,6 +267,7 @@ public function form(array $form, array &$form_state) { $form = parent::form($form, $form_state); // We always show the internal path here. + /** @var \Drupal\Core\Url $url */ $url = $this->getEntity()->getUrlObject(); if ($url->isExternal()) { $default_value = $url->toString(); @@ -299,10 +300,10 @@ public function form(array $form, array &$form_state) { $language_configuration = $this->moduleHandler->invoke('language', 'get_default_configuration', array('menu_link_content', 'menu_link_content')); if ($this->entity->isNew()) { - $default_language = isset($language_configuration['langcode']) ? $language_configuration['langcode'] : $this->languageManager->getDefaultLanguage()->id; + $default_language = isset($language_configuration['langcode']) ? $language_configuration['langcode'] : $this->languageManager->getDefaultLanguage()->getId(); } else { - $default_language = $this->entity->getUntranslated()->language()->id; + $default_language = $this->entity->getUntranslated()->language()->getId(); } $form['langcode'] = array( '#title' => t('Language'), @@ -354,7 +355,7 @@ public function validate(array $form, array &$form_state) { * {@inheritdoc} */ public function buildEntity(array $form, array &$form_state) { - /** @var \Drupal\menu_link_content\Entity\MenuLinkContent $entity */ + /** @var \Drupal\menu_link_content\Entity\MenuLinkContentInterface $entity */ $entity = parent::buildEntity($form, $form_state); $new_definition = $this->extractFormValues($form, $form_state); diff --git a/core/modules/menu_ui/menu_ui.admin.inc b/core/modules/menu_ui/menu_ui.admin.inc index 579a703..0d7a0fd 100644 --- a/core/modules/menu_ui/menu_ui.admin.inc +++ b/core/modules/menu_ui/menu_ui.admin.inc @@ -6,7 +6,6 @@ */ use Drupal\Core\Render\Element; -use Drupal\Component\Utility\SafeMarkup; /** * Returns HTML for the menu overview form into a table. @@ -47,8 +46,8 @@ function theme_menu_overview_form($variables) { $row = array(); $row[] = drupal_render($indent) . drupal_render($element['title']); - $row[] = array('data' => drupal_render($element['enabled']), 'class' => array('checkbox', 'menu-enabled')); - $row[] = SafeMarkup::set(drupal_render($element['weight']) . drupal_render($element['parent']) . drupal_render($element['id'])); + $row[] = array('data' => drupal_render($element['hidden']), 'class' => array('checkbox', 'menu-enabled')); + $row[] = drupal_render($element['weight']) . drupal_render($element['plid']) . drupal_render($element['mlid']); $row[] = drupal_render($element['operations']); $row = array_merge(array('data' => $row), $element['#attributes']); diff --git a/core/modules/menu_ui/src/Form/MenuLinkEditForm.php b/core/modules/menu_ui/src/Form/MenuLinkEditForm.php index 26ecb95..4e87ffb 100644 --- a/core/modules/menu_ui/src/Form/MenuLinkEditForm.php +++ b/core/modules/menu_ui/src/Form/MenuLinkEditForm.php @@ -14,6 +14,10 @@ /** * Defines a generic edit form for all menu link plugin types. + * + * The menu link plugin defines which class defines the corresponding form. + * + * @see \Drupal\Core\Menu\MenuLinkInterface::getFormClass() */ class MenuLinkEditForm extends FormBase {