Unverified Commit d3b28470 authored by ghost of drupal past's avatar ghost of drupal past Committed by Lucas Hedding
Browse files

Issue #3311965 by heddn, Charlie ChX Negyesi: Route names do not mesh with the relation names

parent 7df81ba3
Loading
Loading
Loading
Loading
+2 −2
Changes for group_content_menu.links.action.yml: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -9,8 +9,8 @@ entity.group_content_menu.add_page:
  title: 'Add new menu'
  appears_on:
    - entity.group_content_menu.collection
entity.group_content_menu.add_link:
  route_name: entity.group_content_menu.add_link
entity.group_content_menu.add_menu_link:
  route_name: entity.group_content_menu.add_menu_link
  title: 'Add link'
  class: \Drupal\menu_ui\Plugin\Menu\LocalAction\MenuLinkAdd
  appears_on:
+1 −1
Changes for src/Controller/GroupContentMenuController.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ class GroupContentMenuController extends GroupContentController {
        $description = $this->t('Add new menu of type %bundle_label to the group.', ['%bundle_label' => $bundle_label]);
        $build['#bundles'][$bundle_name]['label'] = $bundle_label;
        $build['#bundles'][$bundle_name]['description'] = $description;
        $build['#bundles'][$bundle_name]['add_link'] = Link::createFromRoute($label, 'entity.group_content_menu.add_form', ['group' => $group->id(), 'plugin_id' => $plugin_id]);
        $build['#bundles'][$bundle_name]['add_menu'] = Link::createFromRoute($label, 'entity.group_content_menu.add_form', ['group' => $group->id(), 'plugin_id' => $plugin_id]);
      }
    }

+3 −6
Changes for src/Form/GroupContentMenuForm.php: 3 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -164,10 +164,7 @@ class GroupContentMenuForm extends ContentEntityForm {
    // Supply the empty text.
    if ($has_permission) {
      $form['links']['#empty'] = $this->t('There are no menu links yet. <a href=":url">Add link</a>.', [
        ':url' => Url::fromRoute('entity.group_content_menu.add_link', [
          'group' => $group->id(),
          'group_content_menu' => $this->entity->id(),
        ], [
        ':url' => $this->entity->toUrl('add-menu-link', [
          'query' => ['destination' => $this->entity->toUrl('edit-form')->toString()],
        ])->toString(),
      ]);
@@ -279,7 +276,7 @@ class GroupContentMenuForm extends ContentEntityForm {
        ];
        // Use this module's edit route for the menu. This means we don't have
        // to give elevated menu_ui access to edit menu links.
        $operations['edit']['url'] = Url::fromRoute('entity.group_content_menu.edit_link', [
        $operations['edit']['url'] = Url::fromRoute('entity.group_content_menu.edit_menu_link', [
          'group' => $group->id(),
          'group_content_menu' => $this->entity->id(),
          'menu_link_content' => $link->getMetaData()['entity_id'],
@@ -295,7 +292,7 @@ class GroupContentMenuForm extends ContentEntityForm {
          ];
        }
        if ($link->isDeletable()) {
          $operations['delete']['url'] = Url::fromRoute('entity.group_content_menu.delete_link', [
          $operations['delete']['url'] = Url::fromRoute('entity.group_content_menu.delete_menu_link', [
            'group' => $group->id(),
            'group_content_menu' => $this->entity->id(),
            'menu_link_content' => $link->getMetaData()['entity_id'],
+3 −3
Changes for src/Routing/GroupContentMenuRouteProvider.php: 3 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -20,13 +20,13 @@ class GroupContentMenuRouteProvider extends DefaultHtmlRouteProvider {
    $collection = parent::getRoutes($entity_type);

    if ($add_menu_link = $this->getAddMenuLink($entity_type)) {
      $collection->add('entity.group_content_menu.add_link', $add_menu_link);
      $collection->add('entity.group_content_menu.add_menu_link', $add_menu_link);
    }
    if ($edit_menu_link = $this->getEditMenuLink($entity_type)) {
      $collection->add('entity.group_content_menu.edit_link', $edit_menu_link);
      $collection->add('entity.group_content_menu.edit_menu_link', $edit_menu_link);
    }
    if ($delete_menu_link = $this->getDeleteMenuLink($entity_type)) {
      $collection->add('entity.group_content_menu.delete_link', $delete_menu_link);
      $collection->add('entity.group_content_menu.delete_menu_link', $delete_menu_link);
    }

    return $collection;
+9 −8
Changes for tests/src/Functional/GroupContentMenuTest.php: 9 added lines, 8 removed lines.
Original line number Diff line number Diff line
@@ -135,20 +135,21 @@ class GroupContentMenuTest extends GroupBrowserTestBase {

    // Create new group content menu.
    $this->drupalGet('/group/1/menu/add');
    $menu_label = $this->randomString();
    $page->fillField('label[0][value]', $menu_label);
    $new_menu_label = $this->randomString();
    $page->fillField('label[0][value]', $new_menu_label);
    $page->pressButton('Save');

    // Only one group content menu instance is created.
    $this->drupalGet('/group/1/content');
    $assert->pageTextContainsOnce($menu_label);
    $assert->pageTextContainsOnce($new_menu_label);

    // Verify menu settings render when a group menu has been created.
    $this->drupalGet('/group/1/content/create/group_node:page');
    $assert->pageTextContains('Menu settings');
    $assert->pageTextContains('Parent link');
    $assert->optionExists('menu[menu_parent]', $menu_label);
    $assert->optionExists('menu[menu_parent]', 'Main navigation');
    $page->checkField('menu[enabled]');
    $assert->optionExists('menu[menu_parent]', "<$new_menu_label ($group_name)>");
    $assert->optionExists('menu[menu_parent]', '<Main navigation>');
    $page->fillField('title[0][value]', 'Group node');
    $page->pressButton('Save');
    $this->drupalGet('/node/2/edit');
@@ -599,18 +600,18 @@ class GroupContentMenuTest extends GroupBrowserTestBase {
      'group_content_menu' => 1,
    ]));
    $assert->statusCodeEquals($status_code);
    $this->drupalGet(Url::fromRoute('entity.group_content_menu.add_link', [
    $this->drupalGet(Url::fromRoute('entity.group_content_menu.add_menu_link', [
      'group' => 1,
      'group_content_menu' => 1,
    ]));
    $assert->statusCodeEquals($status_code);
    $this->drupalGet(Url::fromRoute('entity.group_content_menu.edit_link', [
    $this->drupalGet(Url::fromRoute('entity.group_content_menu.edit_menu_link', [
      'group' => 1,
      'group_content_menu' => 1,
      'menu_link_content' => 1,
    ]));
    $assert->statusCodeEquals($status_code);
    $this->drupalGet(Url::fromRoute('entity.group_content_menu.delete_link', [
    $this->drupalGet(Url::fromRoute('entity.group_content_menu.delete_menu_link', [
      'group' => 1,
      'group_content_menu' => 1,
      'menu_link_content' => 1,