Problem/Motivation

Verify that the old messages icons are no longer used and remove them

See: #1356602: [META] Clean up icons in misc

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue category Task because it's cleaning up old images in favour of the new SVGs, these are deprecated images that we don't want core/contrib using anymore.
Issue priority Not critical because it does not break anything, it's just cleaner to remove them.
Unfrozen changes Are images unfrozen? If CSS is unfrozen then I guess images can be as well.
Disruption Disruptive for contributed and custom modules/themes that are referencing these images, but it's a one line code change to reference the new images.
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

MarkoT91’s picture

Status: Active » Needs review
FileSize
8.82 KB

Icons for messages are removed from misc. I doubled checked them all they are not in usage.

Status: Needs review » Needs work

The last submitted patch, 1: remove-messages-icons-in-misc-2358675-1.patch, failed testing.

euphoric_mv’s picture

Status: Needs work » Reviewed & tested by the community

Tested and old massage icons are not there anymore.

Can't figure it out why it didn't pass the test.

Also checked few pages for usability of this icons and they are switched with new SVG icons from the /core/misc/icons folder.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

Well I get the same fails locally so we can't commit this patch until someone does work out why.

function filter_filter_secure_image_alter(&$image) {
  // Turn an invalid image into an error indicator.
  $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')) . ' ' : '');
  $class .= 'filter-image-invalid';
  $image->setAttribute('class', $class);
}

Almost certainly this code is why.

grepping the codebase for message.*png should return no results - we need to update 4 instances to the new svg path.

LewisNyman’s picture

Status: Needs work » Needs review
FileSize
11.36 KB

Here is the patch with changes made to the references to messages-16-error.png. I can't find any mention of 'message-16' or 'message-24' now.

Status: Needs review » Needs work

The last submitted patch, 5: remove-messages-icons-in-misc-2358675-5.patch, failed testing.

LewisNyman’s picture

Status: Needs work » Needs review
FileSize
11.58 KB
880 bytes

I've hardcoded the height and width size because SVG has no default height and width. I guess the other option is to remove the height and width completely.

Status: Needs review » Needs work

The last submitted patch, 7: remove-messages-icons-in-misc-2358675-7.patch, failed testing.

BarisW’s picture

Status: Needs work » Needs review
FileSize
11.57 KB
753 bytes

HTML width and height attributes expect a numeric value, so we don't need the px. This should let the tests succeed too.

LewisNyman’s picture

Status: Needs review » Reviewed & tested by the community

Tests are passing so I think we are good to go.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs issue summary update

This issue is a normal task so we need to outline how it fits within the allowable Drupal 8 beta criteria. Can someone add Drupal 8 beta phase evaluation template to the issue summary.
Action: Needs work, Needs issue summary update

LewisNyman’s picture

Issue summary: View changes
Status: Needs work » Reviewed & tested by the community
Issue tags: -Needs issue summary update

Ok done, maybe we should write a change notice for the parent issue?

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs change record

Good point @LewisNyman yep a CR for the parent issue - and connect it all the child issues.

LewisNyman’s picture

Status: Needs work » Needs review
Issue tags: -Needs change record

Ok here is the change record, can anyone review it quickly? https://www.drupal.org/node/2384159

emma.maria’s picture

Status: Needs review » Reviewed & tested by the community

I have read the change record and it describes the changes well and links to the Meta issue. Setting this to RTBC.

mondrake’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/modules/filter/filter.module
@@ -831,13 +831,13 @@ function _filter_html_image_secure_process($text) {
   $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());
+  $error_image = $image_factory->get('core/misc/icons/ea2800/error.svg');
+  $image->setAttribute('height', '16');
+  $image->setAttribute('width',  '16');
 

We can avoid entirely going through the image factory in this case. No need for $image_factory and $error_image variables.

Actually, the underlying toolkit (GD) will not be able to load an SVG image here (it can be checked by calling $error_image->isValid() that will just return FALSE).

LewisNyman’s picture

FileSize
753 bytes
11.5 KB

Ok, sounds simple enough. I removed those two variables and it still works.

LewisNyman’s picture

Status: Needs work » Needs review
FileSize
696.68 KB

mgifford’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
344.5 KB

Looks good to me. I'm happy to mark this RTBC.

Here's a copy of an error message:
error with svg

alexpott’s picture

The patch in #17 has never been tested - not sure why - reuploading - no commit credit for me, thanks.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed aec0d2b and pushed to 8.0.x. Thanks!

Thanks for adding the beta evaluation for to the issue summary.

  • alexpott committed aec0d2b on 8.0.x
    Issue #2358675 by LewisNyman, BarisW, mgifford, MarkoT91: Remove...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.