Problem/Motivation

Reduce code duplication between SvgImageFormatter and SvgResponsiveImageFormatter.

Proposed resolution

Use a trait to share common code between those 2 formatters.

Remaining tasks

Publish, review and validate MR.

Issue fork svg_image-3477774

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mably created an issue. See original summary.

mably’s picture

Status: Active » Needs review

mrshowerman made their first commit to this issue’s fork.

mrshowerman’s picture

I was able to further reduce duplicate code by moving some parts of the viewElements() method into new trait methods. The slight differences between SvgImageFormatter and SvgResponsiveImageFormatter we noticed in #3257729: Formatters shouldn't repeat core code today were respected, especially the cache tags handling 😉

mably’s picture

Definitely a nice additional code factorization, thanks @mrshowerman!

mably’s picture

Made a few tests, everything seems to work fine.

@grevil do you want to have a look at the MR before I merge it?

grevil’s picture

@mably go for it!

  • mably committed 42981d6d on 3.x
    Issue #3477774 by mably, mrshowerman: Use a trait to reduce code...
mably’s picture

Status: Needs review » Fixed

Merged!

Status: Fixed » Closed (fixed)

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

mably’s picture

Assigned: mably » Unassigned