Commit 2d4cdae1 authored by alexpott's avatar alexpott
Browse files

Issue #2125769 by c31ck, mErilainen | anandps: Set width & height for "missing image" placeholder.

parent bf7b0174
......@@ -1206,6 +1206,10 @@ function filter_filter_secure_image_alter(&$image) {
$image->setAttribute('src', base_path() . 'core/misc/message-16-error.png');
$image->setAttribute('alt', t('Image removed.'));
$image->setAttribute('title', t('This image has been removed. For security reasons, only images from the local domain are allowed.'));
$image_factory = \Drupal::service('image.factory');
$error_image = $image_factory->get('core/misc/message-16-error.png');
$image->setAttribute('height', $error_image->getHeight());
$image->setAttribute('width', $error_image->getWidth());
// Add a CSS class to aid in styling.
$class = ($image->getAttribute('class') ? trim($image->getAttribute('class')) . ' ' : '');
......
......@@ -144,6 +144,8 @@ function testImageSource() {
$this->assertEqual((string) $element['src'], $red_x_image);
$this->assertEqual((string) $element['alt'], $alt_text);
$this->assertEqual((string) $element['title'], $title_text);
$this->assertEqual((string) $element['height'], '16');
$this->assertEqual((string) $element['width'], '16');
}
else {
$this->assertEqual((string) $element['src'], $converted);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment