| 1 | <?php |
||
| 15 | class StringMapper implements MapperInterface |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * Check if the current mapper can handle the given type. |
||
| 19 | * |
||
| 20 | * @param string $type |
||
| 21 | * |
||
| 22 | * @return bool |
||
| 23 | */ |
||
| 24 | public function canHandleType($type) |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Get the TCA configuration for the current type. |
||
| 33 | * |
||
| 34 | * @param string $fieldName |
||
| 35 | * @param bool $overWriteLabel |
||
| 36 | * |
||
| 37 | * @return array |
||
| 38 | */ |
||
| 39 | public function getTcaConfiguration($fieldName, $overWriteLabel = false) |
||
| 40 | { |
||
| 41 | if ('slug' === $fieldName) { |
||
| 42 | return [ |
||
| 43 | 'exclude' => 1, |
||
| 44 | 'label' => $overWriteLabel ? $overWriteLabel : $fieldName, |
||
| 45 | 'config' => [ |
||
| 46 | 'type' => 'slug', |
||
| 47 | 'prependSlash' => true, |
||
| 48 | 'generatorOptions' => [ |
||
| 49 | 'fields' => [], // 'title' |
||
| 50 | 'prefixParentPageSlug' => true, |
||
| 51 | ], |
||
| 52 | 'fallbackCharacter' => '-', |
||
| 53 | 'eval' => 'uniqueInSite', |
||
| 54 | ], |
||
| 55 | ]; |
||
| 56 | } |
||
| 57 | |||
| 58 | return [ |
||
| 59 | 'exclude' => 1, |
||
| 60 | 'label' => $overWriteLabel ? $overWriteLabel : $fieldName, |
||
| 61 | 'config' => [ |
||
| 62 | 'type' => 'input', |
||
| 63 | ], |
||
| 64 | ]; |
||
| 65 | } |
||
| 66 | |||
| 67 | /** |
||
| 68 | * Get the database definition for the current mapper. |
||
| 69 | * |
||
| 70 | * @return string |
||
| 71 | */ |
||
| 72 | public function getDatabaseDefinition() |
||
| 76 | } |
||
| 77 |