| 1 |
<?php |
| 2 |
|
| 3 |
namespace ImportWP\Common\AddonAPI\Importer\Template; |
| 4 |
|
| 5 |
class Panel extends Group |
| 6 |
{ |
| 7 |
private $_id; |
| 8 |
private $_name; |
| 9 |
private $_repeater = false; |
| 10 |
|
| 11 |
public function __construct($name, $args = []) |
| 12 |
{ |
| 13 |
$this->_id = $args['id'] ?? sanitize_title($name); |
| 14 |
$this->_name = $name; |
| 15 |
} |
| 16 |
|
| 17 |
public function get_id() |
| 18 |
{ |
| 19 |
return $this->_id; |
| 20 |
} |
| 21 |
|
| 22 |
public function get_name() |
| 23 |
{ |
| 24 |
return $this->_name; |
| 25 |
} |
| 26 |
|
| 27 |
public function get_args() |
| 28 |
{ |
| 29 |
$args = []; |
| 30 |
|
| 31 |
if ($this->is_repeater()) { |
| 32 |
$args['type'] = 'repeatable'; |
| 33 |
} |
| 34 |
|
| 35 |
return $args; |
| 36 |
} |
| 37 |
|
| 38 |
public function repeater($bool = true) |
| 39 |
{ |
| 40 |
$this->_repeater = $bool; |
| 41 |
return $this; |
| 42 |
} |
| 43 |
|
| 44 |
public function is_repeater() |
| 45 |
{ |
| 46 |
return $this->_repeater; |
| 47 |
} |
| 48 |
} |
| 49 |
|