[wp-trac] [WordPress Trac] #60524: Cropping site icon should preserve attachment properties
WordPress Trac
noreply at wordpress.org
Fri Feb 16 00:50:35 UTC 2024
#60524: Cropping site icon should preserve attachment properties
-------------------------------------+----------------------------
Reporter: afercia | Owner: rcreators
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: 6.5
Component: Media | Version:
Severity: normal | Resolution:
Keywords: has-patch needs-testing | Focuses: accessibility
-------------------------------------+----------------------------
Comment (by joedolson):
Thank you, @rcreators!
This does work, but I don't think that the method is optimal. It does the
job, but it splits the logic so that identical logic is being applied in
different places. This makes long-term code maintenance harder.
I think that a better path might be to create a helper function that
copies the attachment data as needed. E.g.,
{{{
function wp_copy_parent_attachment_properties( $attachment, $parent ) {
// Logic to check and modify attachment array.
return $attachment;
}
}}}
Then, all the logic is in one place, and we can call it as needed.
Thoughts?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/60524#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list