Created
November 16, 2016 16:13
-
-
Save rachellawson/36f7c8d99085d98ab561a263834ac304 to your computer and use it in GitHub Desktop.
Getting all that facebook comment malarkey off into a tab, that only appears when the field_facebook_comment field on the node is true.
@jpstacey - I presume in getNode()
$node = $requestStack->getCurrentRequest()->attributes->get('node');
must be
$node = $this->requestStack->getCurrentRequest()->attributes->get('node');
Yes, sorry - copypasta error
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hardwired
\Drupal::
is to be avoided (it makes the code harder to test or reuse), so I'd recommend replacing one with$this->entityTypeManager()
whichControllerBase
gives you, and the other with:This turns your
getNode()
into:The DI is a few extra lines but it saves you heartache in future. For example, if you want to decouple the entity type manager too, you only need to modify a couple of lines: