Skip to content
Snippets Groups Projects

Issue 2780511: Do no set lang on untranslatable menu links

Open Alec Smrekar requested to merge issue/drupal-2780511:2780511-menu-link-of into 11.x
4 unresolved threads

Closes #2780511

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
69 // Enable translation for page nodes.
70 $this->enableContentTranslation('node', 'page');
71 }
72
73 /**
74 * Gets a content entity object by title.
75 *
76 * @param string $entity_type_id
77 * Id of content entity type of content entity to load.
78 * @param string $title
79 * Title of content entity to load.
80 *
81 * @return \Drupal\Core\Entity\ContentEntityInterface
82 * First found content entity with given title.
83 */
84 protected function getContentEntityByTitle($entity_type_id, $title) {
  • Suggested change
    84 protected function getContentEntityByTitle($entity_type_id, $title) {
    84 protected function getContentEntityByTitle(string $entity_type_id, string $title): ContentEntityInterface {
  • Please register or sign in to reply
  • 71 71
    72 72 // Enable translation for page nodes and menu link content.
    73 73 static::enableBundleTranslation('node', 'page');
    74 \Drupal::service('content_translation.manager')
  • 21 22 /** @var \Drupal\menu_link_content\MenuLinkContentInterface $entity */
    22 23 if (!empty($values['entity_id'])) {
    23 24 $entity = MenuLinkContent::load($values['entity_id']);
    25 assert($entity instanceof TranslatableInterface);
  • 29 31 $entity = $entity->getTranslation($node->language()->getId());
    30 32 }
    31 33 }
    32 else {
    34 elseif ($entity->isTranslatable()) {
    Please register or sign in to reply
    Loading