diff options
Diffstat (limited to '')
-rw-r--r-- | library/Director/Web/Table/CoreApiPrototypesTable.php | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/library/Director/Web/Table/CoreApiPrototypesTable.php b/library/Director/Web/Table/CoreApiPrototypesTable.php new file mode 100644 index 0000000..78fd964 --- /dev/null +++ b/library/Director/Web/Table/CoreApiPrototypesTable.php @@ -0,0 +1,43 @@ +<?php + +namespace Icinga\Module\Director\Web\Table; + +use ipl\Html\Html; +use ipl\Html\Table; +use gipfl\Translation\TranslationHelper; + +class CoreApiPrototypesTable extends Table +{ + use TranslationHelper; + + protected $defaultAttributes = ['class' => ['common-table']]; + + protected $prototypes; + + protected $typeName; + + public function __construct($prototypes, $typeName) + { + $this->prototypes = $prototypes; + $this->typeName = $typeName; + } + + public function assemble() + { + if (empty($this->prototypes)) { + return; + } + $this->add(Html::tag('thead', Html::tag('tr', Html::wrapEach($this->getColumnsToBeRendered(), 'th')))); + $type = $this->typeName; + foreach ($this->prototypes as $name) { + $this->add($this::tr($this::td("$type.$name()"))); + } + } + + public function getColumnsToBeRendered() + { + return [ + $this->translate('Name'), + ]; + } +} |