| | |
| | | |
| | | |
| | | use JVBase\base\Site; |
| | | use JVBase\inc\registrar\helpers\AddCustomFields; |
| | | use JVBase\inc\registrar\helpers\HideSingle; |
| | | use JVBase\managers\Cache; |
| | | use JVBase\managers\CRUD; |
| | |
| | | public bool $baseless = false; |
| | | public bool $modify = false; |
| | | |
| | | protected ?AddCustomFields $addFields = null; |
| | | |
| | | protected static array $allFlags = [ |
| | | //Shared Flags |
| | | 'favouritable', 'karma', 'show_feed', 'show_directory', 'approve_new', 'has_responses', 'invitable', |
| | |
| | | { |
| | | $this->fields = new Fields($this->type, $this); |
| | | } |
| | | public function getFields():array |
| | | public function getFields(bool $includeDefaults = true):array |
| | | { |
| | | return array_map(function ($field) { |
| | | return $field->getConfig(); |
| | | }, |
| | | $this->fields->getFields() |
| | | $this->fields->getFields($includeDefaults) |
| | | ); |
| | | } |
| | | public function setIcon(string $icon):self |
| | |
| | | if ($this->registrar) { |
| | | $this->registrar->register(); |
| | | } |
| | | $this->addFields = new AddCustomFields($this); |
| | | 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); |