| | |
| | | |
| | | 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 |
| | |
| | | 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) { |
| | |
| | | } |
| | | 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'); |
| | | } |
| | | } |
| | | } |