Skip to content

Commit e3bd2da

Browse files
committed
Ability to move existing block into the tab using its name
1 parent 3704657 commit e3bd2da

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

Block/Tab/LayoutXmlReference.php

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
namespace Swissup\Easytabs\Block\Tab;
4+
5+
use Magento\Framework\View\Element\BlockInterface;
6+
use Magento\Framework\View\Element\Text\ListText;
7+
8+
class LayoutXmlReference extends ListText implements BlockInterface
9+
{
10+
public function setTemplate($childNames)
11+
{
12+
$names = explode(',', $childNames);
13+
14+
foreach ($names as $i => $name) {
15+
if ($child = $this->getLayout()->getBlock($name)) {
16+
$this->setChild('easytab.xml.' . $i, $child);
17+
}
18+
}
19+
20+
return $this;
21+
}
22+
}

etc/easytabs.xml

+10
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,16 @@
176176
</parameter>
177177
</parameters>
178178
</widget>
179+
<widget id="easytabs_xml_reference" class="Swissup\Easytabs\Block\Tab\LayoutXmlReference" is_email_compatible="false"
180+
placeholder_image="" ttl="86400">
181+
<label translate="true">Reference to the Layout XML Block</label>
182+
<description>Move existing layout XML block to the tab</description>
183+
<parameters>
184+
<parameter name="widget_template" xsi:type="text" required="true" visible="true">
185+
<label translate="true">Block name in Layout XML</label>
186+
</parameter>
187+
</parameters>
188+
</widget>
179189
<widget id="easytabs_cms" class="Swissup\Easytabs\Block\Tab\Cms" is_email_compatible="false"
180190
placeholder_image="" ttl="86400">
181191
<label translate="true">CMS Static Block</label>

0 commit comments

Comments
 (0)