From 747d741293e064a979d7bf6c143ef969ea6d7629 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sun, 24 May 2026 20:49:44 +0000
Subject: [PATCH] =GMBReview block minor tweaks. Refactored ReferralManager.php and ReferralRoutes.php to utilize the manager for all logic, and CustomTable for table interactions.
---
inc/registrar/Registrar.php | 31 +++++++++++++++++++++++++++----
1 files changed, 27 insertions(+), 4 deletions(-)
diff --git a/inc/registrar/Registrar.php b/inc/registrar/Registrar.php
index 83c36bd..81c78da 100644
--- a/inc/registrar/Registrar.php
+++ b/inc/registrar/Registrar.php
@@ -48,11 +48,13 @@
public ?string $rewrite_taxonomy = null;
+ public bool $add_image_column = false;
+
protected static array $allFlags = [
//Shared Flags
'favouritable', 'karma', 'show_feed', 'show_directory', 'approve_new', 'has_responses', 'invitable',
//Post Flags
- 'hide_single', 'redirect_to_author', 'is_calendar', 'single_image', 'is_timeline', 'is_gallery', 'is_faq', 'is_glossary', 'rewrite_taxonomy',
+ 'hide_single', 'redirect_to_author', 'is_calendar', 'single_image', 'is_timeline', 'is_gallery', 'is_faq', 'is_glossary', 'rewrite_taxonomy', 'add_image_column',
//Taxonomy Flags
'is_content', 'is_ownable', 'verify_entry', 'track_changes', 'associate_user_content',
//User Flags
@@ -140,12 +142,12 @@
/**
* @var bool Whether users/content need to request the owner for admission
*/
- protected bool $verify_entry;
+ protected bool $verify_entry = false;
protected ?MakeVerification $verifyEntryHandler = null;
/**
* @var bool Whether we should track post movements from term to term (ie. artists in tattoo shops)
*/
- protected bool $track_changes;
+ protected bool $track_changes = false;
protected ?MakeTrackChanges $trackChangesHandler = null;
/**
@@ -686,6 +688,10 @@
if ($this->registrar) {
$this->registrar->register();
}
+ if ($this->add_image_column) {
+ add_filter("manage_{$this->based}_posts_columns", [$this, 'addImageColumn']);
+ add_action("manage_{$this->based}_posts_custom_column", [$this, 'showImageColumn'], 10, 2);
+ }
} elseif ($this->type === 'term') {
if ($this->is_content) {
if ($this->verify_entry) {
@@ -962,6 +968,23 @@
}
public function getUserSubtype():string|false
{
- return $this->user_subtype?:false;
+ return $this->user_subtype??false;
+ }
+
+ public function addImageColumn(array $columns):array
+ {
+ $keys = array_keys($columns);
+ $index = array_search('cb', $keys);
+ if ($index !== false) {
+ $pos = $index+1;
+ $columns = array_slice($columns, 0, $pos, true) + ['jvb_featured_image' => 'Image'] + array_slice($columns, $pos, null, true);
+ }
+ return $columns;
+ }
+ public function showImageColumn(string $column, int $postID):void
+ {
+ if ($column === 'jvb_featured_image') {
+ echo get_the_post_thumbnail($postID, 'tiny');
+ }
}
}
--
Gitblit v1.10.0