allow loading of lazy tabs for secondary tabs as well (#4839)

This commit is contained in:
Marc Jauvin 2019-12-21 23:24:42 -05:00 committed by Samuel Georges
parent adb303a53c
commit 3a49b5fa7a
3 changed files with 4 additions and 2 deletions

View File

@ -465,8 +465,9 @@ class Form extends WidgetBase
{
$target = post('target');
$tabName = post('name');
$tabSection = post('section');
$fields = array_get(optional($this->getTab('primary'))->fields, $tabName);
$fields = array_get(optional($this->getTab($tabSection))->fields, $tabName);
return [
$target => $this->makePartial('form_fields', ['fields' => $fields]),

View File

@ -172,6 +172,7 @@
data: {
target: $el.data('target'),
name: $el.data('tab-name'),
section: $el.data('tab-section'),
},
success: function(data) {
this.success(data)

View File

@ -18,7 +18,7 @@
$lazy = in_array($name, $tabs->lazy);
?>
<li class="<?= ($index++ === 0) ? 'active' : '' ?> <?= $lazy ? 'tab-lazy' : '' ?>">
<a href="#<?= $type . 'tab-' . $index ?>" data-tab-name="<?= e($name) ?>">
<a href="#<?= $type . 'tab-' . $index ?>" data-tab-name="<?= e($name) ?>" data-tab-section="<?= $type ?>">
<span class="title">
<span>
<?php if ($tabs->getIcon($name)): ?><span class="<?= $tabs->getIcon($name) ?>"></span><?php endif; ?>