wintercms / wn-blocks-plugin

Block based content management plugin for Winter CMS.
MIT License
21 stars 5 forks source link

Add block render functions #10

Closed damsfx closed 1 year ago

damsfx commented 1 year ago

Adds the ability to render block contents from PHP.

// Render all model's blocks
\Winter\Blocks\Classes\Block::renderAll($model->blocks);

// render a model block
\Winter\Blocks\Classes\Block::render($model->blocks[0]);

// Render a defined block
\Winter\Blocks\Classes\Block::render('title', [
    'content' => 'Lorem ipsum dolor sit amet.',
    'alignment_x' => 'left',
    'size' => 'h1',
]);