From 91c4c9287381c9471bfaf6088d38ed71243cbe86 Mon Sep 17 00:00:00 2001
From: Alex Pott <alex.a.pott@googlemail.com>
Date: Thu, 22 Dec 2016 10:43:32 +0000
Subject: [PATCH] Revert "Issue #2836381 by phenaproxima, Wim Leers: Seven's
 entity-add-list template omits link attributes"

This reverts commit f01ac2d4d845f4819a82f775db469ec99f5d7ebf.
---
 .../Controller/EntityTestEntityController.php | 30 ------------
 .../src/Entity/EntityTestWithBundle.php       |  2 +-
 .../src/Routing/HtmlRouteProvider.php         | 23 ----------
 .../SevenBundleAddPageLinkAttributesTest.php  | 46 -------------------
 .../seven/templates/entity-add-list.html.twig |  2 +-
 5 files changed, 2 insertions(+), 101 deletions(-)
 delete mode 100644 core/modules/system/tests/modules/entity_test/src/Controller/EntityTestEntityController.php
 delete mode 100644 core/modules/system/tests/modules/entity_test/src/Routing/HtmlRouteProvider.php
 delete mode 100644 core/modules/system/tests/src/Functional/SevenBundleAddPageLinkAttributesTest.php

diff --git a/core/modules/system/tests/modules/entity_test/src/Controller/EntityTestEntityController.php b/core/modules/system/tests/modules/entity_test/src/Controller/EntityTestEntityController.php
deleted file mode 100644
index 823cea958270..000000000000
--- a/core/modules/system/tests/modules/entity_test/src/Controller/EntityTestEntityController.php
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-
-namespace Drupal\entity_test\Controller;
-
-use Drupal\Core\Entity\Controller\EntityController;
-use Symfony\Component\HttpFoundation\Response;
-
-/**
- * Controller for test entities based on the core EntityController.
- */
-class EntityTestEntityController extends EntityController {
-
-  /**
-   * {@inheritdoc}
-   */
-  public function addPage($entity_type_id) {
-    $response = parent::addPage($entity_type_id);
-
-    if ($response instanceof Response) {
-      return $response;
-    }
-    foreach ($response['#bundles'] as $bundle) {
-      $bundle['add_link']->getUrl()->setOption('attributes', [
-        'class' => ['bundle-link'],
-      ]);
-    }
-    return $response;
-  }
-
-}
diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestWithBundle.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestWithBundle.php
index 57a7a730808d..c668bd3ee80b 100644
--- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestWithBundle.php
+++ b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestWithBundle.php
@@ -21,7 +21,7 @@
  *       "delete" = "\Drupal\Core\Entity\EntityDeleteForm"
  *     },
  *     "route_provider" = {
- *       "html" = "Drupal\entity_test\Routing\HtmlRouteProvider",
+ *       "html" = "Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider",
  *     },
  *   },
  *   base_table = "entity_test_with_bundle",
diff --git a/core/modules/system/tests/modules/entity_test/src/Routing/HtmlRouteProvider.php b/core/modules/system/tests/modules/entity_test/src/Routing/HtmlRouteProvider.php
deleted file mode 100644
index 475cd34d286b..000000000000
--- a/core/modules/system/tests/modules/entity_test/src/Routing/HtmlRouteProvider.php
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-
-namespace Drupal\entity_test\Routing;
-
-use Drupal\Core\Entity\EntityTypeInterface;
-use Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider;
-use Drupal\entity_test\Controller\EntityTestEntityController;
-
-/**
- * Route provider for test entities.
- */
-class HtmlRouteProvider extends DefaultHtmlRouteProvider {
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function getAddPageRoute(EntityTypeInterface $entity_type) {
-    return parent::getAddPageRoute($entity_type)
-      ->setDefault('_controller', EntityTestEntityController::class . '::addPage')
-      ->setOption('_admin_route', TRUE);
-  }
-
-}
diff --git a/core/modules/system/tests/src/Functional/SevenBundleAddPageLinkAttributesTest.php b/core/modules/system/tests/src/Functional/SevenBundleAddPageLinkAttributesTest.php
deleted file mode 100644
index 3a200a929cca..000000000000
--- a/core/modules/system/tests/src/Functional/SevenBundleAddPageLinkAttributesTest.php
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-
-namespace Drupal\Tests\system\Functional;
-
-use Drupal\entity_test\Entity\EntityTestBundle;
-use Drupal\Tests\BrowserTestBase;
-
-/**
- * Tests Seven's handling of link attributes on multi-bundle entity add page.
- *
- * @group system
- */
-class SevenBundleAddPageLinkAttributesTest extends BrowserTestBase {
-
-  /**
-   * {@inheritdoc}
-   */
-  public static $modules = ['entity_test'];
-
-  /**
-   * {@inheritdoc}
-   */
-  protected $profile = 'standard';
-
-  /**
-   * Tests that Seven preserves attributes in multi-bundle entity add links.
-   */
-  public function testSevenBundleAddPageLinkAttributes() {
-    $account = $this->drupalCreateUser(['administer entity_test_with_bundle content']);
-    $this->drupalLogin($account);
-
-    $this->config('system.theme')->set('default', 'seven')->save();
-
-    for ($i = 0; $i < 2; $i++) {
-      EntityTestBundle::create([
-        'id' => $this->randomMachineName(),
-        'label' => $this->randomString(),
-        'description' => $this->randomString(),
-      ])->save();
-    }
-
-    $this->drupalGet('/entity_test_with_bundle/add');
-    $this->assertSession()->elementExists('css', 'a.bundle-link');
-  }
-
-}
diff --git a/core/themes/seven/templates/entity-add-list.html.twig b/core/themes/seven/templates/entity-add-list.html.twig
index f00ecd1fc2fb..3ff2e717df64 100644
--- a/core/themes/seven/templates/entity-add-list.html.twig
+++ b/core/themes/seven/templates/entity-add-list.html.twig
@@ -17,7 +17,7 @@
 {% if bundles is not empty %}
   <ul class="admin-list">
     {% for bundle in bundles %}
-      <li class="clearfix"><a{{ create_attribute(bundle.add_link.url.options.attributes) }} href="{{ bundle.add_link.url }}"><span class="label">{{ bundle.label }}</span><div class="description">{{ bundle.description }}</div></a></li>
+      <li class="clearfix"><a href="{{ bundle.add_link.url }}"><span class="label">{{ bundle.label }}</span><div class="description">{{ bundle.description }}</div></a></li>
     {% endfor %}
   </ul>
 {% elseif add_bundle_message is not empty %}
-- 
GitLab