Browse Source

Code cleanup.

8.x-1.x 8.x-1.7
Chi 8 years ago
parent
commit
33ac865dd3
  1. 6
      src/TwigExtension.php
  2. 4
      tests/twig_tweak_test/twig_tweak_test.info.yml

6
src/TwigExtension.php

@ -77,7 +77,6 @@ class TwigExtension extends \Twig_Extension {
if ($block && $this->entityAccess($block)) { if ($block && $this->entityAccess($block)) {
return $entity_type_manager->getViewBuilder('block')->view($block); return $entity_type_manager->getViewBuilder('block')->view($block);
} }
return NULL;
} }
/** /**
@ -145,7 +144,6 @@ class TwigExtension extends \Twig_Extension {
$render_controller = $entity_type_manager->getViewBuilder($entity_type); $render_controller = $entity_type_manager->getViewBuilder($entity_type);
return $render_controller->view($entity, $view_mode, $langcode); return $render_controller->view($entity, $view_mode, $langcode);
} }
return NULL;
} }
/** /**
@ -178,7 +176,6 @@ class TwigExtension extends \Twig_Extension {
return $entity->{$field_name}->view($view_mode); return $entity->{$field_name}->view($view_mode);
} }
} }
return NULL;
} }
/** /**
@ -373,6 +370,7 @@ class TwigExtension extends \Twig_Extension {
* in an <img> tag. Requesting the URL will cause the image to be created. * in an <img> tag. Requesting the URL will cause the image to be created.
*/ */
public function imageStyle($path, $style) { public function imageStyle($path, $style) {
/** @var \Drupal\Image\ImageStyleInterface $image_style */
if ($image_style = ImageStyle::load($style)) { if ($image_style = ImageStyle::load($style)) {
return file_url_transform_relative($image_style->buildUrl($path)); return file_url_transform_relative($image_style->buildUrl($path));
} }
@ -401,7 +399,7 @@ class TwigExtension extends \Twig_Extension {
* Checks view access to a given entity. * Checks view access to a given entity.
* *
* @param \Drupal\Core\Entity\EntityInterface $entity * @param \Drupal\Core\Entity\EntityInterface $entity
* Entity to check access. * Entity to check access.
* *
* @return bool * @return bool
* The access check result. * The access check result.

4
tests/twig_tweak_test/twig_tweak_test.info.yml

@ -4,5 +4,5 @@ description: Support module for Tweak twig testing.
package: Testing package: Testing
core: 8.x core: 8.x
dependencies: dependencies:
- twig_tweak - drupa:twig_tweak
- node - drupal:node

Loading…
Cancel
Save