Blocks::factory()
Wrapper around the factory to catch blocks from layouts
Blocks::factory(?array $items = null, array $params = [ ]): Kirby\Cms\Blocks
Parameters
Name | Type | Default |
---|---|---|
$items | array |null |
null |
$params | array |
[ ] |
Return type
Parent class
Example
<?php
$blocks = Kirby\Cms\Blocks::factory([
[
'content' => [
'text' => 'Nice heading',
'level' => 'h2',
],
'type' => 'heading',
],
[
'content' => [
'text' => 'Some text here',
],
'type' => 'text',
],
[
'content' => [
'text' => 'Time flies like an arrow; fruit flies like a banana',
'citation' => '<a href=\"https://en.wikipedia.org/wiki/Anthony_Oettinger\" rel=\"noopener noreferrer nofollow\">Anthony Oettinger</a>',
],
'type' => 'quote',
],
]);
echo $blocks;