Problem/Motivation

Repeat mention of "attributes" in docblock for template_preprocess_image_style(&$variables) preprocess function:
https://git.drupalcode.org/project/drupal/blob/8.8.x/core/modules/image/...

/**
 * Prepares variables for image style templates.
 *
 * Default template: image-style.html.twig.
 *
 * @param array $variables
 *   An associative array containing:
 *   - width: The width of the image.
 *   - height: The height of the image.
 *   - style_name: The name of the image style to be applied.
 *   - attributes: Additional attributes to apply to the image.
 *   - uri: URI of the source image before styling.
 *   - alt: The alternative text for text-based browsers. HTML 4 and XHTML 1.0
 *     always require an alt attribute. The HTML 5 draft allows the alt
 *     attribute to be omitted in some cases. Therefore, this variable defaults
 *     to an empty string, but can be set to NULL for the attribute to be
 *     omitted. Usually, neither omission nor an empty string satisfies
 *     accessibility requirements, so it is strongly encouraged for code using
 *     '#theme' => 'image_style' to pass a meaningful value for this variable.
 *     - http://www.w3.org/TR/REC-html40/struct/objects.html#h-13.8
 *     - http://www.w3.org/TR/xhtml1/dtds.html
 *     - http://dev.w3.org/html5/spec/Overview.html#alt
 *   - title: The title text is displayed when the image is hovered in some
 *     popular browsers.
 *   - attributes: Associative array of attributes to be placed in the img tag.
 */
function template_preprocess_image_style(&$variables) {

Proposed resolution

Combine the substance of the two, and, idk the proper order of things? It's obviously not alphabetical... is it the order in which the variables get declared in the code that follows, or?

Remaining tasks

Initial patch coming in a minute -- with my best guess/effort for combining the substance of the documentation, and ordering :)

User interface changes

API changes

Data model changes

Release notes snippet

CommentFileSizeAuthor
#3 drupal-image-docblock-3083444-3.patch1.18 KBalison

Comments

alisonjo315 created an issue. See original summary.

alison’s picture

Title: Duplicate mention of "attributes" in doc block » Duplicate "attributes" in docblock
alison’s picture

StatusFileSize
new1.18 KB
alison’s picture

Status: Active » Needs review
andrewmacpherson’s picture

Status: Needs review » Reviewed & tested by the community

Nice quick win.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 3: drupal-image-docblock-3083444-3.patch, failed testing. View results

andrewmacpherson’s picture

Status: Needs work » Reviewed & tested by the community

#6: Spurious test failure, unrelated to the patch here. Queued new test, green again.

  • webchick committed 7b5662f on 8.8.x
    Issue #3083444 by alisonjo315: Duplicate "attributes" in docblock
    
webchick’s picture

Status: Reviewed & tested by the community » Fixed

Hey, great catch!

Committed and pushed to 8.8.x, and backported to 8.7.x. Thanks!

  • webchick committed fd1ad57 on 8.7.x
    Issue #3083444 by alisonjo315: Duplicate "attributes" in docblock
    
    (...

Status: Fixed » Closed (fixed)

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