| 1 |
<?php |
| 2 |
|
| 3 |
namespace ipl\Web\FormElement\TermInput; |
| 4 |
|
| 5 |
use BadMethodCallException; |
| 6 |
|
| 7 |
class ValidatedTerm extends \ipl\Web\Control\SearchBar\ValidatedTerm implements Term |
| 8 |
{ |
| 9 |
public const DEFAULT_PATTERN = Term::DEFAULT_CONSTRAINT; |
| 10 |
|
| 11 |
/** @var ?string The CSS class */ |
| 12 |
protected $class; |
| 13 |
|
| 14 |
public function setClass(string $class): Term |
| 15 |
{ |
| 16 |
$this->class = $class; |
| 17 |
|
| 18 |
return $this; |
| 19 |
} |
| 20 |
|
| 21 |
public function getClass(): ?string |
| 22 |
{ |
| 23 |
return $this->class; |
| 24 |
} |
| 25 |
|
| 26 |
public function toTermData() |
| 27 |
{ |
| 28 |
$data = parent::toTermData(); |
| 29 |
$data['class'] = $this->getClass(); |
| 30 |
|
| 31 |
return $data; |
| 32 |
} |
| 33 |
|
| 34 |
public function toMetaData() |
| 35 |
{ |
| 36 |
throw new BadMethodCallException(self::class . '::toTermData() not implemented yet'); |
| 37 |
} |
| 38 |
} |