wpseek.com
A WordPress-centric search engine for devs and theme authors
render_block_core_accordion › WordPress Function
Since6.9.0
Deprecatedn/a
› render_block_core_accordion ( $attributes, $content )
| Parameters: (2) |
|
| Returns: |
|
| Defined at: |
|
| Codex: |
Server-side rendering of the `core/accordion` block.
Source
function render_block_core_accordion( $attributes, $content ) {
if ( ! $content ) {
return $content;
}
$p = new WP_HTML_Tag_Processor( $content );
$autoclose = $attributes['autoclose'] ? 'true' : 'false';
if ( $p->next_tag( array( 'class_name' => 'wp-block-accordion' ) ) ) {
$p->set_attribute( 'data-wp-interactive', 'core/accordion' );
$p->set_attribute( 'data-wp-context', '{ "autoclose": ' . $autoclose . ', "accordionItems": [] }' );
// Only modify content if directives have been set.
$content = $p->get_updated_html();
}
return $content;
}