chg: [helpers:bootstrap] Formatted file

pull/93/head
Sami Mokaddem 2021-11-23 15:29:55 +01:00
parent 3c0237f387
commit 87ac0f7569
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
1 changed files with 100 additions and 70 deletions

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Bootstrap Tabs helper * Bootstrap Tabs helper
* Options: * Options:
@ -255,7 +256,8 @@ class BootstrapTabs extends BootstrapGeneric
]; ];
private $bsClasses = null; private $bsClasses = null;
function __construct($options) { function __construct($options)
{
$this->allowedOptionValues = [ $this->allowedOptionValues = [
'justify' => [false, 'center', 'end'], 'justify' => [false, 'center', 'end'],
'body-variant' => array_merge(BootstrapGeneric::$variants, ['']), 'body-variant' => array_merge(BootstrapGeneric::$variants, ['']),
@ -401,7 +403,8 @@ class BootstrapTabs extends BootstrapGeneric
"bg-{$this->options['header-variant']}", "bg-{$this->options['header-variant']}",
"text-{$this->options['header-text-variant']}", "text-{$this->options['header-text-variant']}",
"border-{$this->options['header-border-variant']}" "border-{$this->options['header-border-variant']}"
])]); ]
)]);
$html .= $this->genNav(); $html .= $this->genNav();
$html .= $this->closeNode('div'); $html .= $this->closeNode('div');
$html .= $this->openNode('div', ['class' => array_merge( $html .= $this->openNode('div', ['class' => array_merge(
@ -412,7 +415,8 @@ class BootstrapTabs extends BootstrapGeneric
[ [
"bg-{$this->options['body-variant']}", "bg-{$this->options['body-variant']}",
"text-{$this->options['body-text-variant']}" "text-{$this->options['body-text-variant']}"
])]); ]
)]);
$html .= $this->genContent(); $html .= $this->genContent();
$html .= $this->closeNode('div'); $html .= $this->closeNode('div');
$html .= $this->closeNode('div'); $html .= $this->closeNode('div');
@ -485,7 +489,8 @@ class BootstrapTabs extends BootstrapGeneric
} }
} }
class BoostrapAlert extends BootstrapGeneric { class BoostrapAlert extends BootstrapGeneric
{
private $defaultOptions = [ private $defaultOptions = [
'text' => '', 'text' => '',
'html' => null, 'html' => null,
@ -496,7 +501,8 @@ class BoostrapAlert extends BootstrapGeneric {
private $bsClasses = null; private $bsClasses = null;
function __construct($options) { function __construct($options)
{
$this->allowedOptionValues = [ $this->allowedOptionValues = [
'variant' => BootstrapGeneric::$variants, 'variant' => BootstrapGeneric::$variants,
]; ];
@ -547,7 +553,8 @@ class BoostrapAlert extends BootstrapGeneric {
} }
} }
class BoostrapTable extends BootstrapGeneric { class BoostrapTable extends BootstrapGeneric
{
private $defaultOptions = [ private $defaultOptions = [
'striped' => true, 'striped' => true,
'bordered' => true, 'bordered' => true,
@ -562,7 +569,8 @@ class BoostrapTable extends BootstrapGeneric {
private $bsClasses = null; private $bsClasses = null;
function __construct($options, $data, $btHelper) { function __construct($options, $data, $btHelper)
{
$this->allowedOptionValues = [ $this->allowedOptionValues = [
'variant' => array_merge(BootstrapGeneric::$variants, ['']) 'variant' => array_merge(BootstrapGeneric::$variants, [''])
]; ];
@ -700,7 +708,8 @@ class BoostrapTable extends BootstrapGeneric {
} }
} }
class BoostrapListTable extends BootstrapGeneric { class BoostrapListTable extends BootstrapGeneric
{
private $defaultOptions = [ private $defaultOptions = [
'striped' => true, 'striped' => true,
'bordered' => false, 'bordered' => false,
@ -714,7 +723,8 @@ class BoostrapListTable extends BootstrapGeneric {
private $bsClasses = null; private $bsClasses = null;
function __construct($options, $data, $btHelper) { function __construct($options, $data, $btHelper)
{
$this->allowedOptionValues = [ $this->allowedOptionValues = [
'variant' => array_merge(BootstrapGeneric::$variants, ['']) 'variant' => array_merge(BootstrapGeneric::$variants, [''])
]; ];
@ -827,7 +837,8 @@ class BoostrapListTable extends BootstrapGeneric {
private function getElementPath($type) private function getElementPath($type)
{ {
return sprintf('%s%sField', return sprintf(
'%s%sField',
$this->options['elementsRootPath'] ?? '', $this->options['elementsRootPath'] ?? '',
$type $type
); );
@ -839,7 +850,8 @@ class BoostrapListTable extends BootstrapGeneric {
} }
} }
class BoostrapButton extends BootstrapGeneric { class BoostrapButton extends BootstrapGeneric
{
private $defaultOptions = [ private $defaultOptions = [
'id' => '', 'id' => '',
'text' => '', 'text' => '',
@ -859,7 +871,8 @@ class BoostrapButton extends BootstrapGeneric {
private $bsClasses = []; private $bsClasses = [];
function __construct($options) { function __construct($options)
{
$this->allowedOptionValues = [ $this->allowedOptionValues = [
'variant' => array_merge(BootstrapGeneric::$variants, ['link', 'text']), 'variant' => array_merge(BootstrapGeneric::$variants, ['link', 'text']),
'size' => ['', 'xs', 'sm', 'lg'], 'size' => ['', 'xs', 'sm', 'lg'],
@ -952,7 +965,8 @@ class BoostrapButton extends BootstrapGeneric {
} }
} }
class BoostrapBadge extends BootstrapGeneric { class BoostrapBadge extends BootstrapGeneric
{
private $defaultOptions = [ private $defaultOptions = [
'text' => '', 'text' => '',
'variant' => 'primary', 'variant' => 'primary',
@ -961,7 +975,8 @@ class BoostrapBadge extends BootstrapGeneric {
'class' => [], 'class' => [],
]; ];
function __construct($options) { function __construct($options)
{
$this->allowedOptionValues = [ $this->allowedOptionValues = [
'variant' => BootstrapGeneric::$variants, 'variant' => BootstrapGeneric::$variants,
]; ];
@ -995,7 +1010,8 @@ class BoostrapBadge extends BootstrapGeneric {
} }
} }
class BoostrapIcon extends BootstrapGeneric { class BoostrapIcon extends BootstrapGeneric
{
private $icon = ''; private $icon = '';
private $defaultOptions = [ private $defaultOptions = [
'class' => [], 'class' => [],
@ -1003,7 +1019,8 @@ class BoostrapIcon extends BootstrapGeneric {
'params' => [], 'params' => [],
]; ];
function __construct($icon, $options=[]) { function __construct($icon, $options = [])
{
$this->icon = $icon; $this->icon = $icon;
$this->processOptions($options); $this->processOptions($options);
} }
@ -1032,7 +1049,8 @@ class BoostrapIcon extends BootstrapGeneric {
} }
} }
class BoostrapModal extends BootstrapGeneric { class BoostrapModal extends BootstrapGeneric
{
private $defaultOptions = [ private $defaultOptions = [
'size' => '', 'size' => '',
'centered' => true, 'centered' => true,
@ -1057,7 +1075,8 @@ class BoostrapModal extends BootstrapGeneric {
private $bsClasses = null; private $bsClasses = null;
function __construct($options) { function __construct($options)
{
$this->allowedOptionValues = [ $this->allowedOptionValues = [
'size' => ['sm', 'lg', 'xl', ''], 'size' => ['sm', 'lg', 'xl', ''],
'type' => ['ok-only', 'confirm', 'confirm-success', 'confirm-warning', 'confirm-danger', 'custom'], 'type' => ['ok-only', 'confirm', 'confirm-success', 'confirm-warning', 'confirm-danger', 'custom'],
@ -1140,7 +1159,8 @@ class BoostrapModal extends BootstrapGeneric {
return $footer; return $footer;
} }
private function getFooterBasedOnType() { private function getFooterBasedOnType()
{
if ($this->options['type'] == 'ok-only') { if ($this->options['type'] == 'ok-only') {
return $this->getFooterOkOnly(); return $this->getFooterOkOnly();
} else if (str_contains($this->options['type'], 'confirm')) { } else if (str_contains($this->options['type'], 'confirm')) {
@ -1304,7 +1324,8 @@ class BoostrapCard extends BootstrapGeneric
} }
} }
class BoostrapSwitch extends BootstrapGeneric { class BoostrapSwitch extends BootstrapGeneric
{
private $defaultOptions = [ private $defaultOptions = [
'label' => '', 'label' => '',
'variant' => 'primary', 'variant' => 'primary',
@ -1315,7 +1336,8 @@ class BoostrapSwitch extends BootstrapGeneric {
'attrs' => [], 'attrs' => [],
]; ];
function __construct($options) { function __construct($options)
{
$this->allowedOptionValues = [ $this->allowedOptionValues = [
'variant' => BootstrapGeneric::$variants, 'variant' => BootstrapGeneric::$variants,
]; ];
@ -1358,7 +1380,8 @@ class BoostrapSwitch extends BootstrapGeneric {
} }
} }
class BoostrapProgress extends BootstrapGeneric { class BoostrapProgress extends BootstrapGeneric
{
private $defaultOptions = [ private $defaultOptions = [
'value' => 0, 'value' => 0,
'total' => 100, 'total' => 100,
@ -1371,7 +1394,8 @@ class BoostrapProgress extends BootstrapGeneric {
'label' => true 'label' => true
]; ];
function __construct($options) { function __construct($options)
{
$this->allowedOptionValues = [ $this->allowedOptionValues = [
'variant' => BootstrapGeneric::$variants, 'variant' => BootstrapGeneric::$variants,
]; ];
@ -1418,13 +1442,15 @@ class BoostrapProgress extends BootstrapGeneric {
} }
} }
class BoostrapCollapse extends BootstrapGeneric { class BoostrapCollapse extends BootstrapGeneric
{
private $defaultOptions = [ private $defaultOptions = [
'text' => '', 'text' => '',
'open' => false, 'open' => false,
]; ];
function __construct($options, $content, $btHelper) { function __construct($options, $content, $btHelper)
{
$this->allowedOptionValues = []; $this->allowedOptionValues = [];
$this->processOptions($options); $this->processOptions($options);
$this->content = $content; $this->content = $content;
@ -1565,7 +1591,8 @@ class BoostrapAccordion extends BootstrapGeneric
} }
} }
class BoostrapProgressTimeline extends BootstrapGeneric { class BoostrapProgressTimeline extends BootstrapGeneric
{
private $defaultOptions = [ private $defaultOptions = [
'steps' => [], 'steps' => [],
'selected' => 0, 'selected' => 0,
@ -1573,7 +1600,8 @@ class BoostrapProgressTimeline extends BootstrapGeneric {
'variantInactive' => 'secondary', 'variantInactive' => 'secondary',
]; ];
function __construct($options, $btHelper) { function __construct($options, $btHelper)
{
$this->allowedOptionValues = [ $this->allowedOptionValues = [
'variant' => BootstrapGeneric::$variants, 'variant' => BootstrapGeneric::$variants,
'variantInactive' => BootstrapGeneric::$variants, 'variantInactive' => BootstrapGeneric::$variants,
@ -1687,7 +1715,8 @@ class BootstrapListGroup extends BootstrapGeneric
private $bsClasses = null; private $bsClasses = null;
function __construct($options, $data, $btHelper) { function __construct($options, $data, $btHelper)
{
$this->data = $data; $this->data = $data;
$this->processOptions($options); $this->processOptions($options);
$this->btHelper = $btHelper; $this->btHelper = $btHelper;
@ -1789,7 +1818,8 @@ class BoostrapDropdownMenu extends BootstrapGeneric
'submenu_classes' => [], 'submenu_classes' => [],
]; ];
function __construct($options, $btHelper) { function __construct($options, $btHelper)
{
$this->allowedOptionValues = [ $this->allowedOptionValues = [
'direction' => ['start', 'end', 'up', 'down'], 'direction' => ['start', 'end', 'up', 'down'],
'alignment' => ['start', 'end'], 'alignment' => ['start', 'end'],