Issue #2125769 by c31ck, mErilainen | anandps: Set width & height for "missing image" placeholder.
parent
bf7b0174b2
commit
2d4cdae18b
|
@ -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 @@ class FilterHtmlImageSecureTest extends WebTestBase {
|
|||
$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);
|
||||
|
|
Loading…
Reference in New Issue