Changeset 58244 for trunk/src/wp-includes/class-wp-theme-json.php
- Timestamp:
- 05/30/2024 04:38:26 AM (20 months ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/class-wp-theme-json.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-theme-json.php
r58242 r58244 1200 1200 } 1201 1201 foreach ( $style_nodes as &$node ) { 1202 $node ['selector'] = static::scope_selector( $options['scope'], $node['selector']);1202 $node = static::scope_style_node_selectors( $options['scope'], $node ); 1203 1203 } 1204 1204 unset( $node ); … … 1824 1824 $result = implode( ', ', $selectors_scoped ); 1825 1825 return $result; 1826 } 1827 1828 /** 1829 * Scopes the selectors for a given style node. 1830 * 1831 * This includes the primary selector, i.e. `$node['selector']`, as well as any custom 1832 * selectors for features and subfeatures, e.g. `$node['selectors']['border']` etc. 1833 * 1834 * @since 6.6.0 1835 * 1836 * @param string $scope Selector to scope to. 1837 * @param array $node Style node with selectors to scope. 1838 * @return array Node with updated selectors. 1839 */ 1840 protected static function scope_style_node_selectors( $scope, $node ) { 1841 $node['selector'] = static::scope_selector( $scope, $node['selector'] ); 1842 1843 if ( empty( $node['selectors'] ) ) { 1844 return $node; 1845 } 1846 1847 foreach ( $node['selectors'] as $feature => $selector ) { 1848 if ( is_string( $selector ) ) { 1849 $node['selectors'][ $feature ] = static::scope_selector( $scope, $selector ); 1850 } 1851 if ( is_array( $selector ) ) { 1852 foreach ( $selector as $subfeature => $subfeature_selector ) { 1853 $node['selectors'][ $feature ][ $subfeature ] = static::scope_selector( $scope, $subfeature_selector ); 1854 } 1855 } 1856 } 1857 1858 return $node; 1826 1859 } 1827 1860
Note: See TracChangeset
for help on using the changeset viewer.