From 5b50afdcafd150186ea5c7b0e1cad98065590b35 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Fri, 28 Aug 2026 18:44:28 +0000
Subject: [PATCH] =A few more phpStorm suggestions, mainly in PHPDocs
---
inc/ui/CRUDSkeleton.php | 41 ++++++++++++++++++++++++++++++-----------
1 files changed, 30 insertions(+), 11 deletions(-)
diff --git a/inc/ui/CRUDSkeleton.php b/inc/ui/CRUDSkeleton.php
index b231217..c85af69 100644
--- a/inc/ui/CRUDSkeleton.php
+++ b/inc/ui/CRUDSkeleton.php
@@ -38,6 +38,7 @@
protected string $singular = '';
protected string $plural = '';
protected string $icon;
+ protected string $emptyState = '';
// Capabilities
protected array $caps = [];
@@ -145,6 +146,15 @@
return $this;
}
+ public function icon(string $icon):void
+ {
+ $this->icon = $icon;
+ }
+
+ public function getIcon():string
+ {
+ return $this->icon;
+ }
/**
* Set content type information
*/
@@ -533,7 +543,7 @@
* Render the CRUD interface
*/
public function render(): void {
- $config = $this->build();
+
$classes = array_merge(['dashboard-page', $this->dataType], $this->additionalClasses);
// ob_start();
@@ -921,12 +931,13 @@
/**
* Get common terms for taxonomy
* @param string $taxonomy
+ * @param string|null $limit
* @return array
*/
protected function getCommonTerms(string $taxonomy, ?string $limit = null):array {
if ($limit) {
if (Site::has('membership') && $limit === 'user') {
- $manager = new UserTermsManager();
+ $manager = UserTermsManager::getInstance();
return $manager->fetchUserTerms($this->user_id, $taxonomy);
} else {
$limit = (int)$limit;
@@ -1102,15 +1113,23 @@
}
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
--
Gitblit v1.10.0