X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=web%2Fcore%2Fmodules%2Fcontextual%2Fsrc%2FContextualController.php;fp=web%2Fcore%2Fmodules%2Fcontextual%2Fsrc%2FContextualController.php;h=59a2ba0f9512f2874d1de40da9ce6a77bf8164b9;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hp=b1fe245c040eb012b21c90d7d1ca309597f26646;hpb=aea91e65e895364e460983b890e295aa5d5540a5;p=yaffs-website diff --git a/web/core/modules/contextual/src/ContextualController.php b/web/core/modules/contextual/src/ContextualController.php index b1fe245c0..59a2ba0f9 100644 --- a/web/core/modules/contextual/src/ContextualController.php +++ b/web/core/modules/contextual/src/ContextualController.php @@ -2,8 +2,9 @@ namespace Drupal\contextual; -use Symfony\Component\DependencyInjection\ContainerAwareInterface; -use Symfony\Component\DependencyInjection\ContainerAwareTrait; +use Drupal\Core\DependencyInjection\ContainerInjectionInterface; +use Drupal\Core\Render\RendererInterface; +use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; @@ -11,9 +12,32 @@ use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; /** * Returns responses for Contextual module routes. */ -class ContextualController implements ContainerAwareInterface { +class ContextualController implements ContainerInjectionInterface { - use ContainerAwareTrait; + /** + * The renderer. + * @var \Drupal\Core\Render\RendererInterface + */ + protected $render; + + /** + * Constructors a new ContextualController + * + * @param \Drupal\Core\Render\RendererInterface $renderer + * The renderer. + */ + public function __construct(RendererInterface $renderer) { + $this->renderer = $renderer; + } + + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container) { + return new static( + $container->get('renderer') + ); + } /** * Returns the requested rendered contextual links. @@ -38,7 +62,7 @@ class ContextualController implements ContainerAwareInterface { '#type' => 'contextual_links', '#contextual_links' => _contextual_id_to_links($id), ]; - $rendered[$id] = $this->container->get('renderer')->renderRoot($element); + $rendered[$id] = $this->renderer->renderRoot($element); } return new JsonResponse($rendered);