Make WordPress Core


Ignore:
Timestamp:
07/31/2024 02:39:46 AM (23 months ago)
Author:
ramonopoly
Message:

Background: add background attachment support to theme.json styles

Introduces the ability to specify a value for background.backgroundAttachment in theme.json styles.

The theme.json value determines the CSS value for the background-attachment property.

This feature was introduced into the Gutenberg plugin in version 18.9.

Props andrewserong, mukesh27, noisysocks, ramonopoly.

Fixes #61720

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/block-supports/background.php

    r58797 r58834  
    4343 * @since 6.5.0 Added support for `backgroundPosition` and `backgroundRepeat` output.
    4444 * @since 6.6.0 Removed requirement for `backgroundImage.source`. A file/url is the default.
     45 * @since 6.7.0 Added support for `backgroundAttachment` output.
    4546 *
    4647 * @access private
     
    6364    }
    6465
    65     $background_styles                       = array();
    66     $background_styles['backgroundImage']    = $block_attributes['style']['background']['backgroundImage'] ?? null;
    67     $background_styles['backgroundSize']     = $block_attributes['style']['background']['backgroundSize'] ?? null;
    68     $background_styles['backgroundPosition'] = $block_attributes['style']['background']['backgroundPosition'] ?? null;
    69     $background_styles['backgroundRepeat']   = $block_attributes['style']['background']['backgroundRepeat'] ?? null;
     66    $background_styles                         = array();
     67    $background_styles['backgroundImage']      = $block_attributes['style']['background']['backgroundImage'] ?? null;
     68    $background_styles['backgroundSize']       = $block_attributes['style']['background']['backgroundSize'] ?? null;
     69    $background_styles['backgroundPosition']   = $block_attributes['style']['background']['backgroundPosition'] ?? null;
     70    $background_styles['backgroundRepeat']     = $block_attributes['style']['background']['backgroundRepeat'] ?? null;
     71    $background_styles['backgroundAttachment'] = $block_attributes['style']['background']['backgroundAttachment'] ?? null;
    7072
    7173    if ( ! empty( $background_styles['backgroundImage'] ) ) {
Note: See TracChangeset for help on using the changeset viewer.