Skip to content

Instantly share code, notes, and snippets.

@biplobice
Last active April 22, 2022 08:58
Show Gist options
  • Save biplobice/c06e66619b6d209b6638a9738b5fb685 to your computer and use it in GitHub Desktop.
Save biplobice/c06e66619b6d209b6638a9738b5fb685 to your computer and use it in GitHub Desktop.
A simple hack to support tabbed navigation both on Concrete CMS v8.X & v9.X
<?php
// v8 compatibility
if (Config::get('concrete.version_installed') < 9) {
?>
<script>
$('.tab-pane').each(function () {
$(this).removeClass('active').attr('id', 'ccm-tab-content-' + $(this).attr('id'));
if ($(this).hasClass('show')) {
$(this).removeClass('show').show();
}
});
</script>
<?php
}
<?php defined('C5_EXECUTE') or die('Access Denied.');
// @see https://documentation.concretecms.org/tutorials/using-tabbed-panels-in-concrete5-5-7
echo Core::make('helper/concrete/ui')->tabs([
['feed-details', t('Feed Details'), true],
['feed-settings', t('Feed Settings')],
['text-colors', t('Text and Colors')],
]);
?>
<div class="tab-content">
<div id="feed-details" class="tab-pane show active" role="tabpanel">
<div class="form-group">
<?php echo $form->label('text1', t('Text 1')); ?>
<?php echo $form->text('text1', $text1)?>
</div>
</div>
<div id="feed-settings" class="tab-pane" role="tabpanel">
<div class="form-group">
<?php echo $form->label('text2', t('Text 2')); ?>
<?php echo $form->text('text2', $text2)?>
</div>
</div>
<div id="text-colors" class="tab-pane" role="tabpanel">
<div class="form-group">
<?php echo $form->label('text3', t('Text 3')); ?>
<?php echo $form->text('text3', $text3)?>
</div>
</div>
</div>
<?php
// v8 compatibility
if (Config::get('concrete.version_installed') < 9) {
?>
<script>
$('.tab-pane').each(function () {
$(this).removeClass('active').attr('id', 'ccm-tab-content-' + $(this).attr('id'));
if ($(this).hasClass('show')) {
$(this).removeClass('show').show();
}
});
</script>
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment