protected function ImageDimensionsTest::getImageTag in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/image/src/Tests/ImageDimensionsTest.php \Drupal\image\Tests\ImageDimensionsTest::getImageTag()
Render an image style element.
drupal_render() alters the passed $variables array by adding a new key '#printed' => TRUE. This prevents next call to re-render the element. We wrap drupal_render() in a helper protected method and pass each time a fresh array so that $variables won't get altered and the element is re-rendered each time.
1 call to ImageDimensionsTest::getImageTag()
- ImageDimensionsTest::testImageDimensions in core/
modules/ image/ src/ Tests/ ImageDimensionsTest.php - Test styled image dimensions cumulatively.
File
- core/
modules/ image/ src/ Tests/ ImageDimensionsTest.php, line 288 - Contains \Drupal\image\Tests\ImageDimensionsTest.
Class
- ImageDimensionsTest
- Tests that images have correct dimensions when styled.
Namespace
Drupal\image\TestsCode
protected function getImageTag($variables) {
return str_replace("\n", NULL, \Drupal::service('renderer')
->renderRoot($variables));
}