diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 0b7608c..dbc2593 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -1851,7 +1851,7 @@ function theme_dropbutton_wrapper($variables) { } /** - * Prepares variables for an image. + * Prepares variables for image templates. * * Default template: image.html.twig. * @@ -1884,6 +1884,9 @@ function template_preprocess_image(&$variables) { $attributes[$key] = $variables[$key]; } } + // Remove 'image' from the class array. This is added through + // template_preprocess() but we do not need it. + $attributes['class'] = array_diff($attributes['class'], array('image')); $variables['attributes'] = new Attribute($attributes); } diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageDimensionsTest.php b/core/modules/image/lib/Drupal/image/Tests/ImageDimensionsTest.php index e7552d2..b4be34b 100644 --- a/core/modules/image/lib/Drupal/image/Tests/ImageDimensionsTest.php +++ b/core/modules/image/lib/Drupal/image/Tests/ImageDimensionsTest.php @@ -70,7 +70,7 @@ function testImageDimensions() { image_effect_save($style, $effect); $img_tag = theme_image_style($variables); - $this->assertEqual($img_tag, ''); + $this->assertEqual(trim($img_tag), ''); $this->assertFalse(file_exists($generated_uri), 'Generated file does not exist.'); $this->drupalGet($url); $this->assertResponse(200, 'Image was generated at the URL.'); @@ -91,7 +91,7 @@ function testImageDimensions() { image_effect_save($style, $effect); $img_tag = theme_image_style($variables); - $this->assertEqual($img_tag, ''); + $this->assertEqual(trim($img_tag), ''); $this->assertFalse(file_exists($generated_uri), 'Generated file does not exist.'); $this->drupalGet($url); $this->assertResponse(200, 'Image was generated at the URL.'); @@ -113,7 +113,7 @@ function testImageDimensions() { image_effect_save($style, $effect); $img_tag = theme_image_style($variables); - $this->assertEqual($img_tag, ''); + $this->assertEqual(trim($img_tag), ''); $this->assertFalse(file_exists($generated_uri), 'Generated file does not exist.'); $this->drupalGet($url); $this->assertResponse(200, 'Image was generated at the URL.'); @@ -135,7 +135,7 @@ function testImageDimensions() { image_effect_save($style, $effect); $img_tag = theme_image_style($variables); - $this->assertEqual($img_tag, ''); + $this->assertEqual(trim($img_tag), ''); $this->assertFalse(file_exists($generated_uri), 'Generated file does not exist.'); $this->drupalGet($url); $this->assertResponse(200, 'Image was generated at the URL.'); @@ -153,7 +153,7 @@ function testImageDimensions() { image_effect_save($style, $effect); $img_tag = theme_image_style($variables); - $this->assertEqual($img_tag, ''); + $this->assertEqual(trim($img_tag), ''); $this->assertFalse(file_exists($generated_uri), 'Generated file does not exist.'); $this->drupalGet($url); $this->assertResponse(200, 'Image was generated at the URL.'); @@ -174,7 +174,7 @@ function testImageDimensions() { image_effect_save($style, $effect); $img_tag = theme_image_style($variables); - $this->assertEqual($img_tag, ''); + $this->assertEqual(trim($img_tag), ''); $this->assertFalse(file_exists($generated_uri), 'Generated file does not exist.'); $this->drupalGet($url); $this->assertResponse(200, 'Image was generated at the URL.'); @@ -194,7 +194,7 @@ function testImageDimensions() { image_effect_save($style, $effect); $img_tag = theme_image_style($variables); - $this->assertEqual($img_tag, ''); + $this->assertEqual(trim($img_tag), ''); $this->assertFalse(file_exists($generated_uri), 'Generated file does not exist.'); $this->drupalGet($url); $this->assertResponse(200, 'Image was generated at the URL.'); @@ -215,7 +215,7 @@ function testImageDimensions() { image_effect_save($style, $effect); $img_tag = theme_image_style($variables); - $this->assertEqual($img_tag, ''); + $this->assertEqual(trim($img_tag), ''); $this->assertFalse(file_exists($generated_uri), 'Generated file does not exist.'); $this->drupalGet($url); $this->assertResponse(200, 'Image was generated at the URL.'); @@ -233,6 +233,6 @@ function testImageDimensions() { image_effect_save($style, $effect); $img_tag = theme_image_style($variables); - $this->assertEqual($img_tag, ''); + $this->assertEqual(trim($img_tag), ''); } } diff --git a/core/modules/system/templates/image.html.twig b/core/modules/system/templates/image.html.twig index d3234da..0263101 100644 --- a/core/modules/system/templates/image.html.twig +++ b/core/modules/system/templates/image.html.twig @@ -1,10 +1,10 @@ {# /** * @file - * Default theme implementation an image. + * Default theme implementation of an image. * * Available variables: - * - attributes: Associative array of attributes to be placed in the img tag. + * - attributes: An array of HTML attributes for the img tag. * * @see template_preprocess() * @see template_preprcoess_image() @@ -12,4 +12,4 @@ * @ingroup themable */ #} - +