I have 3 blocks that are in the cms block and displayed on the cms page.
How to place each block in a separate custom tab
3 templates:
app/code/Qqq/Wwwww/view/frontend/templates/template1.phtml
app/code/Qqq/Wwwww/view/frontend/templates/template2.phtml
app/code/Qqq/Wwwww/view/frontend/templates/template3.phtml
cms block install script:
app/code/Qqq/Wwwww/Setup/InstallData.php
$block = < <block 1
{{block class=”QqqWwwwwBlockQw” name=”block_1″ template=”Qqq_Wwww::template1.phtml”}}
{{block class=”QqqWwwwwBlockQw” name=”block_2″ template=”Qq_Wwww::template2.phtml”}}
{{block class=”QqqWwwwwBlockQw” name=”block_3″ template=”Qq_Wwww::template3.phtml”}}
BLOCK_CONTENT;
$cmsBlock = [
‘title’ => ‘Block 1’,
‘identifier’ => ‘blocks’,
‘stores’ => [0],
‘is_active’ => 1,
‘content’ => $block
];
$this->blockFactory->create()->setData($cmsBlock)->save();
cms page install script:
$pageContent = < < 'Blocks Page', // cms page title
'page_layout' => '1column', // cms page layout
'meta_keywords' => 'Blocks Page', // cms page meta keywords
'meta_description' => 'Blocks Page', // cms page description
'identifier' => 'blocks-page', // cms page url identifier
'content_heading' => '', // Page heading
'content' => $pageContent, // page content
'is_active' => 1, // define active status
'stores' => [0], // assign to stores
'sort_order' => 0 // page sort order
];