Make WordPress Core

Ticket #57506: 57506.functions1.patch

File 57506.functions1.patch, 2.4 KB (added by sabernhardt, 19 months ago)

includes theme.json changes from 57506.2.patch and introduces a functions.php file for server-side filter to override in RTL

  • src/wp-content/themes/twentytwentythree/functions.php

     
     1<?php
     2/**
     3 * Twenty Twenty-Three functions and definitions
     4 *
     5 * @link https://developer.wordpress.org/themes/basics/theme-functions/
     6 *
     7 * @package WordPress
     8 * @subpackage Twenty_Twenty_Three
     9 * @since Twenty Twenty-Three 1.2
     10 */
     11
     12
     13/**
     14 * Modifies the theme JSON data.
     15 *
     16 * @since Twenty Twenty-Three 1.2 Reverse Quote block border in right-to-left languages.
     17 *
     18 * @param object $theme_json The original theme JSON data.
     19 * @return object The modified theme JSON data.
     20 */
     21function twentytwentythree_modify_theme_json( $theme_json ) {
     22        if ( is_rtl() ) {
     23                $new_data = array(
     24                        'version' => 2,
     25                        'styles'  => array(
     26                                'blocks' => array(
     27                                        'core/quote' => array(
     28                                                'border' => array(
     29                                                        'left'  => array(
     30                                                                'width' => '0px'
     31                                                        ),
     32                                                        'right' => array(
     33                                                                'color' => 'inherit',
     34                                                                'style' => 'solid',
     35                                                                'width' => '1px'
     36                                                        )
     37                                                )
     38                                        )
     39                                )
     40                        )
     41                );
     42
     43                // Returns the modified theme JSON data.
     44                return $theme_json->update_with( $new_data );
     45        }
     46
     47        // Returns the original theme JSON data.
     48        return $theme_json;
     49}
     50
     51// Runs the filter after theme setup.
     52function twentytwentythree_apply_theme_json_theme_filters() {
     53        add_filter( 'wp_theme_json_data_theme', 'twentytwentythree_modify_theme_json' );
     54}
     55add_action( 'after_setup_theme', 'twentytwentythree_apply_theme_json_theme_filters' );
     56
  • src/wp-content/themes/twentytwentythree/theme.json

    Property changes on: src/wp-content/themes/twentytwentythree/functions.php
    ___________________________________________________________________
    Added: svn:eol-style
    ## -0,0 +1 ##
    +native
    \ No newline at end of property
     
    539539                        },
    540540                        "core/quote": {
    541541                                "border": {
    542                                         "width": "1px"
     542                                        "left": {
     543                                                "color": "inherit",
     544                                                "style": "solid",
     545                                                "width": "1px"
     546                                        }
    543547                                },
    544548                                "elements": {
    545549                                        "cite": {