1 | <?php |
||
11 | class ReorderFields |
||
12 | { |
||
13 | /** |
||
14 | * Given a simple list of user-supplied field keys or field labels, |
||
15 | * return a reordered version of the field labels matching the |
||
16 | * user selection. |
||
17 | * |
||
18 | * @param string|array $fields The user-selected fields |
||
19 | * @param array $fieldLabels An associative array mapping the field |
||
20 | * key to the field label |
||
21 | * @param array $data The data that will be rendered. |
||
22 | 7 | * |
|
23 | * @return array |
||
24 | 7 | */ |
|
25 | 5 | public function reorder($fields, $fieldLabels, $data) |
|
40 | 2 | ||
41 | 2 | protected function reorderFieldLabels($fields, $fieldLabels, $data) |
|
57 | 2 | ||
58 | 2 | protected function getSelectedFieldKeys($fields, $fieldLabels) |
|
76 | |||
77 | protected function matchFieldInLabelMap($field, $fieldLabels) |
||
89 | |||
90 | /** |
||
91 | * Convert the provided string into a regex suitable for use in |
||
92 | * preg_match. |
||
93 | * |
||
94 | * Matching occurs in the same way as the Symfony Finder component: |
||
95 | * http://symfony.com/doc/current/components/finder.html#file-name |
||
96 | */ |
||
97 | protected function convertToRegex($str) |
||
101 | |||
102 | /** |
||
103 | * Checks whether the string is a regex. This function is copied from |
||
104 | * MultiplePcreFilterIterator in the Symfony Finder component. |
||
105 | * |
||
106 | * @param string $str |
||
107 | * |
||
108 | * @return bool Whether the given string is a regex |
||
109 | */ |
||
110 | protected function isRegex($str) |
||
129 | } |
||
130 |