PHP code example of corrivate / magento2-layout-bricks
1. Go to this page and download the library: Download corrivate/magento2-layout-bricks library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
corrivate / magento2-layout-bricks example snippets
declare(strict_types=1);
/** @var \Magento\Framework\View\Element\Template $block */
/** @var \Magento\Framework\Escaper $escaper */
/** @var \Corrivate\LayoutBricks\Model\Mason $mason */
<?= $block
->getLayout()
->createBlock(\Magento\Framework\View\Element\Template::class)
->setTemplate($template)
<?= $mason('cms.block',
attributes: ['class' => 'border-2 border-stone-400 rounded-lg'],
props: ['block_id' => 'text-block'])
<?= $mason('Corrivate_LayoutBricks::cms/block.phtml', props: ['block_id' => 'test-block'])
<?= $mason('cms.block', props: ['block_id' => 'test-block'])
<?= $mason('input.text', attributes: [
'ext-black',
'placeholder' => 'your input please',
'name' => 'user_comment'
])
<input <?= $attributes->default([
'class' =>
'bg-white',
'disabled' => true,
'type' => 'text'
])
<?= $mason('product-cart', props: ['product' => $product])
declare(strict_types=1);
/** @var \Magento\Framework\View\Element\Template $block */
/** @var \Magento\Framework\Escaper $escaper */
/** @var \Corrivate\LayoutBricks\Model\BrickAttributesBag $attributes */
/** @var \Corrivate\LayoutBricks\Model\BrickPropsBag $props */
declare(strict_types=1);
/** @var \Magento\Framework\View\Element\Template $block */
/** @var \Magento\Framework\Escaper $escaper */
/** @var \Corrivate\LayoutBricks\Model\BrickAttributesBag $attributes */
/** @var \Corrivate\LayoutBricks\Model\BrickPropsBag $props */
// For Hyva users:
/** @var \Hyva\Theme\Model\ViewModelRegistry $viewModels */
$props->default([
// you can supply default scalar values for your props
])->expect([
// specify propName => type for your props
]);