summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxjm2015-07-04 16:17:27 +0100
committerxjm2015-07-04 16:17:27 +0100
commit0b104695bb2425c62fb442ee3fbd4b21e2983219 (patch)
tree171ac6dca6d4e14768678380802cf88af243fee3
parent8d848f2d790d5337725ad19502207dc81ee65d6d (diff)
Revert "Issue #2505669 by pwolanin, jcloys, joshi.rohit100: Inject render service into LinkGenerator instead of calling drupal_render"
This reverts commit 8d848f2d790d5337725ad19502207dc81ee65d6d.
-rw-r--r--core/core.services.yml2
-rw-r--r--core/lib/Drupal/Core/Utility/LinkGenerator.php16
-rw-r--r--core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php2
-rw-r--r--core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php11
4 files changed, 7 insertions, 24 deletions
diff --git a/core/core.services.yml b/core/core.services.yml
index 026f687..0fe0a7f 100644
--- a/core/core.services.yml
+++ b/core/core.services.yml
@@ -695,7 +695,7 @@ services:
arguments: ['@request_stack', '@config.factory', '@path_processor_manager']
link_generator:
class: Drupal\Core\Utility\LinkGenerator
- arguments: ['@url_generator', '@module_handler', '@renderer']
+ arguments: ['@url_generator', '@module_handler']
router:
class: Drupal\Core\Routing\AccessAwareRouter
arguments: ['@router.no_access_checks', '@access_manager', '@current_user']
diff --git a/core/lib/Drupal/Core/Utility/LinkGenerator.php b/core/lib/Drupal/Core/Utility/LinkGenerator.php
index 1a9e22f..128dafd 100644
--- a/core/lib/Drupal/Core/Utility/LinkGenerator.php
+++ b/core/lib/Drupal/Core/Utility/LinkGenerator.php
@@ -13,7 +13,6 @@ use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\GeneratedLink;
use Drupal\Core\Link;
use Drupal\Core\Path\AliasManagerInterface;
-use Drupal\Core\Render\RendererInterface;
use Drupal\Core\Routing\UrlGeneratorInterface;
use Drupal\Core\Template\Attribute;
use Drupal\Core\Url;
@@ -38,26 +37,16 @@ class LinkGenerator implements LinkGeneratorInterface {
protected $moduleHandler;
/**
- * The renderer service.
- *
- * @var \Drupal\Core\Render\RendererInterface
- */
- protected $renderer;
-
- /**
* Constructs a LinkGenerator instance.
*
* @param \Drupal\Core\Routing\UrlGeneratorInterface $url_generator
* The url generator.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler.
- * @param \Drupal\Core\Render\RendererInterface $renderer
- * The renderer service.
*/
- public function __construct(UrlGeneratorInterface $url_generator, ModuleHandlerInterface $module_handler, RendererInterface $renderer) {
+ public function __construct(UrlGeneratorInterface $url_generator, ModuleHandlerInterface $module_handler) {
$this->urlGenerator = $url_generator;
$this->moduleHandler = $module_handler;
- $this->renderer = $renderer;
}
/**
@@ -86,7 +75,8 @@ class LinkGenerator implements LinkGeneratorInterface {
// Start building a structured representation of our link to be altered later.
$variables = array(
- 'text' => is_array($text) ? $this->renderer->render($text) : $text,
+ // @todo Inject the service when drupal_render() is converted to one.
+ 'text' => is_array($text) ? drupal_render($text) : $text,
'url' => $url,
'options' => $url->getOptions(),
);
diff --git a/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php b/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php
index 11b6eb8..0e45537 100644
--- a/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php
+++ b/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php
@@ -181,7 +181,7 @@ class FieldPluginBaseTest extends UnitTestCase {
\Drupal::getContainer()->set('unrouted_url_assembler', $this->unroutedUrlAssembler);
- $this->linkGenerator = new LinkGenerator($this->urlGenerator, $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface'), $this->renderer);
+ $this->linkGenerator = new LinkGenerator($this->urlGenerator, $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface'));
}
/**
diff --git a/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php b/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php
index ae8f54e..fde662c 100644
--- a/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php
+++ b/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php
@@ -44,13 +44,6 @@ class LinkGeneratorTest extends UnitTestCase {
protected $moduleHandler;
/**
- * The mocked renderer service.
- *
- * @var \PHPUnit_Framework_MockObject_MockObject|\Drupal\Core\Render\RendererInterface
- */
- protected $renderer;
-
- /**
* The mocked URL Assembler service.
*
* @var \PHPUnit_Framework_MockObject_MockObject|\Drupal\Core\Utility\UnroutedUrlAssemblerInterface
@@ -75,8 +68,8 @@ class LinkGeneratorTest extends UnitTestCase {
$this->urlGenerator = $this->getMock('\Drupal\Core\Routing\UrlGenerator', array(), array(), '', FALSE);
$this->moduleHandler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
- $this->renderer = $this->getMock('\Drupal\Core\Render\RendererInterface');
- $this->linkGenerator = new LinkGenerator($this->urlGenerator, $this->moduleHandler, $this->renderer);
+
+ $this->linkGenerator = new LinkGenerator($this->urlGenerator, $this->moduleHandler);
$this->urlAssembler = $this->getMock('\Drupal\Core\Utility\UnroutedUrlAssemblerInterface');
}