[PP-1] ImageToolkitOperations need traits

Created on 1 October 2015, almost 10 years ago
Updated 8 August 2025, 4 days ago

Problem/Motivation

The GD image toolkit operations implement the ::arguments() and ::validateArguments() methods.
This code is mostly boilerplate, and other toolkits need to re-enter the same code because their operations are extended from a base class that, basically, does nothing more than redefine the type of the ::getToolkit() method to the actual toolkit.
For this reason, toolkit operations can not inherit from an independent 'operation base class', so code in the two methods indicated above needs to be replicated.

Proposed resolution

Introduce a trait for each operation (e.g. CropTrait, RotateTrait, ScaleTrait, etc.) with ::arguments() and ::validateArguments() implementations, so that each toolkit operation can use its own trait and only implement a toolkit specific ::execute() method. This approach is already implemented in the contrib Image Effects module.

Remaining tasks

Wait for 📌 Move GD-specific code from Rotate::validateArguments() to Rotate::execute() Needs work .

User interface changes

None

API changes

To be determined

Data model changes

None

📌 Task
Status

Postponed

Version

11.0 🔥

Component

image system

Created by

🇮🇹Italy mondrake 🇮🇹

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024