1 | <?php |
||
18 | class Slug extends FilterRule |
||
19 | { |
||
20 | /** |
||
21 | * Allows a default value to be set if no data key was provided |
||
22 | * |
||
23 | * @var bool |
||
24 | */ |
||
25 | protected $allowNotSet = true; |
||
26 | |||
27 | /** |
||
28 | * @var string |
||
29 | */ |
||
30 | private $fieldToSlugFrom; |
||
31 | |||
32 | /** |
||
33 | * @var string |
||
34 | */ |
||
35 | private $transliterator = 'Any-Latin; Latin-ASCII; NFD; [:Nonspacing Mark:] Remove; NFC; [:Punctuation:] Remove; Lower();'; |
||
36 | |||
37 | /** |
||
38 | * @param string $fieldToSlugFrom |
||
39 | */ |
||
40 | 11 | public function __construct($fieldToSlugFrom) |
|
44 | |||
45 | /** |
||
46 | * Slug the value of either the actual field of the given one. |
||
47 | * |
||
48 | * @param mixed $value |
||
49 | * @return string |
||
50 | */ |
||
51 | 11 | public function filter($value) |
|
67 | } |
||
68 |