diff options
Diffstat (limited to 'vendor/ipl/web/src/Common/Card.php')
-rw-r--r-- | vendor/ipl/web/src/Common/Card.php | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/vendor/ipl/web/src/Common/Card.php b/vendor/ipl/web/src/Common/Card.php new file mode 100644 index 0000000..e62bab5 --- /dev/null +++ b/vendor/ipl/web/src/Common/Card.php @@ -0,0 +1,55 @@ +<?php + +namespace ipl\Web\Common; + +use ipl\Html\BaseHtmlElement; +use ipl\Html\Html; + +abstract class Card extends BaseHtmlElement +{ + protected $tag = 'section'; + + abstract protected function assembleBody(BaseHtmlElement $body); + + abstract protected function assembleFooter(BaseHtmlElement $footer); + + abstract protected function assembleHeader(BaseHtmlElement $header); + + protected function createBody() + { + $body = Html::tag('div', ['class' => 'card-body']); + + $this->assembleBody($body); + + return $body; + } + + protected function createFooter() + { + $footer = Html::tag('div', ['class' => 'card-footer']); + + $this->assembleFooter($footer); + + return $footer; + } + + protected function createHeader() + { + $header = Html::tag('div', ['class' => 'card-header']); + + $this->assembleHeader($header); + + return $header; + } + + protected function assemble() + { + $this->addAttributes(['class' => 'card']); + + $this->add([ + $this->createHeader(), + $this->createBody(), + $this->createFooter() + ]); + } +} |