wpseek.com
Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.
_flatten_blocks is private and should not be used in themes or plugins directly.
_flatten_blocks › WordPress Function
Od5.9.0
Przestarzałyn/a
› _flatten_blocks ( $blocks )
| Dostęp: |
|
| Parametry: |
|
| Powrót: |
|
| Zdefiniowane na: |
|
| Codex: |
Returns an array containing the references of the passed blocks and their inner blocks.
Powiązane Funkcje: resolve_pattern_blocks, filter_block_kses, parse_blocks, has_blocks, _fix_attachment_links
Źródło
function _flatten_blocks( &$blocks ) {
$all_blocks = array();
$queue = array();
foreach ( $blocks as &$block ) {
$queue[] = &$block;
}
while ( count( $queue ) > 0 ) {
$block = &$queue[0];
array_shift( $queue );
$all_blocks[] = &$block;
if ( ! empty( $block['innerBlocks'] ) ) {
foreach ( $block['innerBlocks'] as &$inner_block ) {
$queue[] = &$inner_block;
}
}
}
return $all_blocks;
}