butes to render on the block wrapper.
* @return string String of HTML attributes.
*/
function get_block_wrapper_attributes( $extra_attributes = array() ) {
$new_attributes = WP_Block_Supports::get_instance()->apply_block_supports();
if ( empty( $new_attributes ) && empty( $extra_attributes ) ) {
return '';
}
// Attribute values are concatenated or overridden depending on the attribute type.
// This is hardcoded on purpose, as we only support a fixed list of attributes.
$attribute_merge_callbacks = array(
'style' => static function ( $new_attribute, $extra_attribute ) {
$styles = array_filter(
array(
rtrim( trim( $new_attribute ), ';' ),
rtrim( trim( $extra_attribute ), ';' ),
)
);
return safecss_filter_attr( implode( ';', array_filter( $styles ) ) );
},
'class' => static function ( $new_attribute, $extra_attribute ) {
$classes = array_merge(
(array) preg_split( '/\s+/', $extra_attribute, -1, PREG_SPLIT_NO_EMPTY ),
(array) preg_split( '/\s+/', $new_attribute, -1, PREG_SPLIT_NO_EMPTY )
);
$classes = array_unique( array_filter( $classes ) );
return implode( ' ', $classes );
},
'id' => static function ( $new_attribute, $extra_attribute ) {
return '' !== $extra_attribute ? $extra_attribute : $new_attribute;
},
'aria-label' => static function ( $new_attribute, $extra_attribute ) {
return '' !== $extra_attribute ? $extra_attribute : $new_attribute;
},
);
$attributes = array();
foreach ( $attribute_merge_callbacks as $attribute_name => $merge_callback ) {
$new_attribute = $new_attributes[ $attribute_name ] ?? '';
$extra_attribute = $extra_attributes[ $attribute_name ] ?? '';
$new_attribute = is_string( $new_attribute ) ? $new_attribute : '';
$extra_attribute = is_string( $extra_attribute ) ? $extra_attribute : '';
if ( '' === $new_attribute && '' === $extra_attribute ) {
continue;
}
$attributes[ $attribute_name ] = $merge_callback( $new_attribute, $extra_attribute );
}
foreach ( $extra_attributes as $attribute_name => $value ) {
if ( ! isset( $attribute_merge_callbacks[ $attribute_name ] ) ) {
$attributes[ $attribute_name ] = $value;
}
}
if ( empty( $attributes ) ) {
return '';
}
$normalized_attributes = array();
foreach ( $attributes as $key => $value ) {
$normalized_attributes[] = $key . '="' . esc_attr( $value ) . '"';
}
return implode( ' ', $normalized_attributes );
}
Fatal error: Uncaught Error: Class 'WP_Block_Supports' not found in /home/he2a35ddd308f/public_html/wp-includes/block-supports/align.php:59
Stack trace:
#0 /home/he2a35ddd308f/public_html/wp-settings.php(408): require()
#1 /home/he2a35ddd308f/public_html/wp-config.php(75): require_once('/home/he2a35ddd...')
#2 /home/he2a35ddd308f/public_html/wp-load.php(50): require_once('/home/he2a35ddd...')
#3 /home/he2a35ddd308f/public_html/wp-blog-header.php(13): require_once('/home/he2a35ddd...')
#4 /home/he2a35ddd308f/public_html/index.php(17): require('/home/he2a35ddd...')
#5 {main}
thrown in /home/he2a35ddd308f/public_html/wp-includes/block-supports/align.php on line 59
Fatal error: Uncaught Error: Call to a member function set() on null in /home/he2a35ddd308f/public_html/wp-includes/l10n.php:857
Stack trace:
#0 /home/he2a35ddd308f/public_html/wp-includes/l10n.php(960): load_textdomain('default', '/home/he2a35ddd...', 'lv')
#1 /home/he2a35ddd308f/public_html/wp-includes/class-wp-fatal-error-handler.php(49): load_default_textdomain()
#2 [internal function]: WP_Fatal_Error_Handler->handle()
#3 {main}
thrown in /home/he2a35ddd308f/public_html/wp-includes/l10n.php on line 857