diff --git a/phpxpress/phpxpress/card.php b/phpxpress/phpxpress/card.php index 18b6877..eb01deb 100644 --- a/phpxpress/phpxpress/card.php +++ b/phpxpress/phpxpress/card.php @@ -16,10 +16,16 @@ private $cardColor; private $textColor; + /* + ** https://getbootstrap.com/docs/5.1/components/card/#border + */ function setBorderColor($color){ $this->borderColor = Code::bootstrapColors($color); } + /* + ** https://getbootstrap.com/docs/5.1/components/card/#background-and-color + */ function setCardColor($color){ $this->cardColor = Code::bootstrapColors($color); } @@ -67,17 +73,31 @@ $this->fieldsArray = array($caption => $value); } + /* + ** Setting a datasource will produce a list of fields (bold caption with light value). + ** E.G. array("Color" => "Red" , "Brand" => "Ferrari" , "Horsepower" => "700HP") + ** will produce: + ** Color: Red + ** Brand: Ferrari + ** Horsepower: 700HP + */ function setDataSource($datasource){ foreach($datasource as $caption => $value){ $this->addField($caption,$value); } } + /* + ** https://getbootstrap.com/docs/5.1/components/card/#titles-text-and-links + */ function addLink($caption, $link){ $this->linksArray[$caption] = $link; } - function addArrayList(Array $list){ + /* + ** https://getbootstrap.com/docs/5.1/components/card/#list-groups + */ + function addArrayToList(Array $list){ if(isset($this->list)){ $this->list = array_merge($this->list, $list); }else{ @@ -85,7 +105,10 @@ } } - function addElementList($element){ + /* + ** https://getbootstrap.com/docs/5.1/components/card/#list-groups + */ + function addElementToList($element){ if(isset($this->list)){ array_push($this->list, $element); }else{ @@ -138,9 +161,9 @@ if(isset($this->linksArray)){ // links foreach($this->linksArray as $caption => $link){ echo ''. $caption .''; - } + } echo '

'; - } + } if(isset($this->button)) echo '' . $this->button["text"] . ''; @@ -151,10 +174,12 @@ echo ''; } + /* + ** Using this overrides the card's width (known error from Bootstrap), so you should specify a width. + ** It always has to be closed with endCardGroupLayout() + ** https://getbootstrap.com/docs/5.1/components/card/#card-groups + */ static function beginCardGroupLayout($width=36){ - /* - ** Using this overrides the card's width (known error from Bootstrap), so you should specify a width. - */ echo '
'; }