summaryrefslogtreecommitdiffstats
path: root/vendor/ipl/web/src/FormElement/TermInput/ValidatedTerm.php
blob: e91c203ccdc0d805a3e9aa4b31a84d691be190ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php

namespace ipl\Web\FormElement\TermInput;

use BadMethodCallException;

class ValidatedTerm extends \ipl\Web\Control\SearchBar\ValidatedTerm implements Term
{
    const DEFAULT_PATTERN = Term::DEFAULT_CONSTRAINT;

    /** @var ?string The CSS class */
    protected $class;

    public function setClass(string $class): Term
    {
        $this->class = $class;

        return $this;
    }

    public function getClass(): ?string
    {
        return $this->class;
    }

    public function toTermData()
    {
        $data = parent::toTermData();
        $data['class'] = $this->getClass();

        return $data;
    }

    public function toMetaData()
    {
        throw new BadMethodCallException(self::class . '::toTermData() not implemented yet');
    }
}