| | |
| | | protected string $singular = ''; |
| | | protected string $plural = ''; |
| | | protected string $icon; |
| | | protected string $emptyState = ''; |
| | | |
| | | // Capabilities |
| | | protected array $caps = []; |
| | |
| | | return $this; |
| | | } |
| | | |
| | | public function icon(string $icon):void |
| | | { |
| | | $this->icon = $icon; |
| | | } |
| | | |
| | | public function getIcon():string |
| | | { |
| | | return $this->icon; |
| | | } |
| | | /** |
| | | * Set content type information |
| | | */ |
| | |
| | | * Render the CRUD interface |
| | | */ |
| | | public function render(): void { |
| | | $config = $this->build(); |
| | | |
| | | $classes = array_merge(['dashboard-page', $this->dataType], $this->additionalClasses); |
| | | |
| | | // ob_start(); |
| | |
| | | } |
| | | protected function renderEmptyState():string |
| | | { |
| | | ob_start(); |
| | | ?> |
| | | <div class="empty-state"> |
| | | <h3><?=jvbDashIcon($this->icon)?>Nothing here<?=jvbDashIcon($this->icon)?></h3> |
| | | <p>It doesn't look like you have any <?=$this->plural ?> yet.</p> |
| | | <p><small><i>Add many by uploading images above.</i>, or click the "<?=jvbDashIcon('plus-square')?>" button to add one at a time.</small></p> |
| | | </div> |
| | | <?php |
| | | return ob_get_clean(); |
| | | |
| | | return empty($this->emptyState) ? sprintf( |
| | | '<div class="empty-state"> |
| | | <h3>%sNothing here%s</h3> |
| | | <p>It doesn\'t look like you have any %s yet.</p> |
| | | <p><small><i>Add many by uploading images above.</i>, or click the "%s" button to add one at a time.</small></p> |
| | | </div>', |
| | | jvbDashIcon($this->icon), |
| | | jvbDashIcon($this->icon), |
| | | $this->plural, |
| | | jvbDashIcon('plus-square') |
| | | ) : $this->emptyState; |
| | | } |
| | | |
| | | public function setEmptyState(string $state):void |
| | | { |
| | | $this->emptyState = $state; |
| | | } |
| | | |
| | | protected function renderGalleryPreviewTemplate():void |