A lot of code cleanup and code sanitation done.
This commit is contained in:
@@ -3,19 +3,19 @@
|
||||
namespace bin\php\Classes;
|
||||
class formBuilder
|
||||
{
|
||||
public $title;
|
||||
public $icon;
|
||||
public $submitButton;
|
||||
public $closeButton;
|
||||
public $closeButtonLocation;
|
||||
public string $title;
|
||||
public string $icon;
|
||||
public mixed $submitButton;
|
||||
public mixed $closeButton;
|
||||
public string $closeButtonLocation;
|
||||
|
||||
public $submitButtonColor;
|
||||
public string $submitButtonColor;
|
||||
|
||||
public $submitButtonText;
|
||||
public mixed $submitButtonText;
|
||||
|
||||
public $submitButtonIcon;
|
||||
public string $submitButtonIcon;
|
||||
|
||||
private $extraButtonsArray = array();
|
||||
private array $extraButtonsArray = array();
|
||||
|
||||
public function __construct($title, $icon, $closeButtonLocation, $submitButton = true, $closeButton = true)
|
||||
{
|
||||
@@ -29,7 +29,7 @@ class formBuilder
|
||||
$this->submitButtonIcon = $icon;
|
||||
}
|
||||
|
||||
public function startForm()
|
||||
public function startForm(): void
|
||||
{ ?>
|
||||
<div class="row"><div class="col-md-8 ms-auto me-auto"><div class="card">
|
||||
<div class="card-header">
|
||||
@@ -52,12 +52,12 @@ class formBuilder
|
||||
# 'buttonColor' => 'success'
|
||||
# ) > next array
|
||||
|
||||
public function addExtraButtons($extraButtonsArray)
|
||||
public function addExtraButtons($extraButtonsArray): bool
|
||||
{
|
||||
foreach ($extraButtonsArray as $numb => $extraButtonArray) {
|
||||
foreach ($extraButtonsArray as $extraButtonArray) {
|
||||
if (is_array($extraButtonArray)) {
|
||||
if (array_key_exists('buttonIcon', $extraButtonArray) && array_key_exists('buttonText', $extraButtonArray) && array_key_exists('buttonHref', $extraButtonArray) && array_key_exists('buttonColor', $extraButtonArray)) {
|
||||
array_push($this->extraButtonsArray, $extraButtonArray);
|
||||
$this->extraButtonsArray[] = $extraButtonArray;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -65,7 +65,7 @@ class formBuilder
|
||||
return false;
|
||||
}
|
||||
|
||||
public function formFooter()
|
||||
public function formFooter(): void
|
||||
{ ?>
|
||||
<div class="card-footer pt-3">
|
||||
<div class="row">
|
||||
@@ -74,7 +74,7 @@ class formBuilder
|
||||
<button type="submit" class="btn btn-<?php echo $this->submitButtonColor ?>"><?php echo $this->submitButtonIcon ?> <?php echo $this->submitButtonText ?></button>
|
||||
<?php }
|
||||
|
||||
foreach ($this->extraButtonsArray as $numb => $extraButtonArray) { ?>
|
||||
foreach ($this->extraButtonsArray as $extraButtonArray) { ?>
|
||||
<a href="<?php echo $extraButtonArray['buttonHref'] ?>" class="btn btn-<?php echo $extraButtonArray['buttonColor'] ?>"><?php echo $extraButtonArray['buttonIcon'] ?> <?php echo $extraButtonArray['buttonText'] ?></a>
|
||||
<?php }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user