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