| | |
| | | protected string $description = ''; |
| | | protected string $icon = ''; |
| | | protected array $fields = []; |
| | | protected Registrar $registrar; |
| | | |
| | | public function __construct(string $title) { |
| | | public function __construct(string $title, Registrar $registrar) { |
| | | $this->title = $title; |
| | | $this->slug = sanitize_title($title); |
| | | $this->registrar = $registrar; |
| | | } |
| | | |
| | | public function setTitle(string $title): self { |
| | |
| | | |
| | | protected function checkFields(string|array $fields):string|array |
| | | { |
| | | $allFields = Registrar::getInstance($this->slug)->getFields(); |
| | | $allFields = $this->registrar->getFields(); |
| | | if (is_array($fields)){ |
| | | foreach ($fields as $index =>$fieldName){ |
| | | if (!array_key_exists($fieldName, $allFields)){ |