| | |
| | | namespace JVBase\registrar\fields; |
| | | |
| | | |
| | | use ReflectionClass; |
| | | |
| | | if (!defined('ABSPATH')) { |
| | | exit; |
| | | } |
| | |
| | | protected string $add_label = 'Add Row'; |
| | | protected string $row_label = 'New Item'; |
| | | |
| | | public function setAdd_label(string $label):void |
| | | public function setAddLabel(string $label):void |
| | | { |
| | | $this->add_label = $label; |
| | | } |
| | | public function getAdd_label():string |
| | | public function getAddLabel():string |
| | | { |
| | | return $this->add_label; |
| | | } |
| | |
| | | $fields = array_filter(array_map(function($field) { return str_replace('}}','',$field);}, explode('{{',$variables))); |
| | | foreach ($fields as $field) { |
| | | if (!array_key_exists($field, $this->fields)) { |
| | | error_log('['.(new \ReflectionClass($this))->getShortName().']Invalid field attempted: '.$field); |
| | | error_log('['.(new ReflectionClass($this))->getShortName().']Invalid field attempted: '.$field); |
| | | return false; |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | public function setRow_label(string $label):void |
| | | public function setRowLabel(string $label):void |
| | | { |
| | | if (str_contains($label, '{{')) { |
| | | if (!$this->checkFieldVariables($label)) { |
| | |
| | | |
| | | $this->row_label = $label; |
| | | } |
| | | public function getRow_label():string |
| | | public function getRowLabel():string |
| | | { |
| | | return $this->row_label; |
| | | } |