wpseek.com
Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.
wp_get_custom_css_state_entries is private and should not be used in themes or plugins directly.
wp_get_custom_css_state_entries › WordPress Function
Od7.2.0
Przestarzałyn/a
› wp_get_custom_css_state_entries ( $style, $block_name, $responsive_media_queries )
| Dostęp: |
|
| Parametry: (3) |
|
| Powrót: |
|
| Zdefiniowane na: |
|
| Codex: |
Collects custom CSS defined for a block instance across its default, pseudo-selector, and viewport states.
Źródło
function wp_get_custom_css_state_entries( $style, $block_name, $responsive_media_queries ) {
$entries = array();
if ( empty( $style ) || ! is_array( $style ) ) {
return $entries;
}
$supported_pseudo_states = WP_Theme_JSON::VALID_BLOCK_PSEUDO_SELECTORS[ $block_name ] ?? array();
if ( wp_custom_css_has_value( $style ) ) {
$entries[] = array(
'css' => $style['css'],
'pseudo' => null,
'media_query' => null,
);
}
foreach ( $supported_pseudo_states as $pseudo_state ) {
$pseudo_style = $style[ $pseudo_state ] ?? null;
if ( wp_custom_css_has_value( $pseudo_style ) ) {
$entries[] = array(
'css' => $pseudo_style['css'],
'pseudo' => $pseudo_state,
'media_query' => null,
);
}
}
foreach ( $responsive_media_queries as $breakpoint => $media_query ) {
$breakpoint_style = $style[ $breakpoint ] ?? null;
if ( ! is_array( $breakpoint_style ) ) {
continue;
}
if ( wp_custom_css_has_value( $breakpoint_style ) ) {
$entries[] = array(
'css' => $breakpoint_style['css'],
'pseudo' => null,
'media_query' => $media_query,
);
}
foreach ( $supported_pseudo_states as $pseudo_state ) {
$breakpoint_pseudo_style = $breakpoint_style[ $pseudo_state ] ?? null;
if ( wp_custom_css_has_value( $breakpoint_pseudo_style ) ) {
$entries[] = array(
'css' => $breakpoint_pseudo_style['css'],
'pseudo' => $pseudo_state,
'media_query' => $media_query,
);
}
}
}
return $entries;
}