wpseek.com
Un motore di ricerca WordPress per sviluppatori e autori di temi
wp_get_state_style_with_fallback_dimension_styles › WordPress Function
Da7.1.0
Deprecaton/a
› wp_get_state_style_with_fallback_dimension_styles ( $state_style )
| Parametri: |
|
| Ritorna: |
|
| Definito a: |
|
| Codex: |
Adds fallback dimension styles for aspectRatio and height block-support values.
Sorgenti
function wp_get_state_style_with_fallback_dimension_styles( $state_style ) {
if ( ! is_array( $state_style ) ) {
return $state_style;
}
$dimensions = isset( $state_style['dimensions'] ) && is_array( $state_style['dimensions'] )
? $state_style['dimensions']
: array();
if ( empty( $dimensions ) ) {
return $state_style;
}
if ( wp_is_explicit_aspect_ratio_value( $dimensions['aspectRatio'] ?? null ) ) {
return array_replace_recursive(
$state_style,
array(
'dimensions' => array(
'minHeight' => 'unset',
'height' => 'unset',
),
)
);
}
$has_min_height = isset( $dimensions['minHeight'] ) && ( is_string( $dimensions['minHeight'] ) || is_numeric( $dimensions['minHeight'] ) ) && '' !== trim( (string) $dimensions['minHeight'] );
$has_height = isset( $dimensions['height'] ) && ( is_string( $dimensions['height'] ) || is_numeric( $dimensions['height'] ) ) && '' !== trim( (string) $dimensions['height'] );
if ( $has_min_height || $has_height ) {
return array_replace_recursive(
$state_style,
array(
'dimensions' => array(
'aspectRatio' => 'unset',
),
)
);
}
return $state_style;
}