1 | <?php |
||
12 | class GridFieldTogglePaginator implements GridField_HTMLProvider, GridField_ActionProvider, GridField_DataManipulator |
||
|
|||
13 | { |
||
14 | /** |
||
15 | * The icon to use on the enable pagination button. Can be null. |
||
16 | * @config |
||
17 | */ |
||
18 | private static $enable_icon; |
||
19 | |||
20 | /** |
||
21 | * The icon to use on the disable pagination button. Can be null. |
||
22 | * @config |
||
23 | */ |
||
24 | private static $disable_icon; |
||
25 | |||
26 | /** |
||
27 | * Fragment to write the button to. |
||
28 | */ |
||
29 | protected $target; |
||
30 | |||
31 | /** |
||
32 | * ID of the session data. |
||
33 | */ |
||
34 | protected $state_id; |
||
35 | |||
36 | /** |
||
37 | * Session data (an associative array). |
||
38 | */ |
||
39 | protected $state; |
||
40 | |||
41 | |||
42 | public function __construct($target = 'buttons-before-right') |
||
46 | |||
47 | /** |
||
48 | * Update $state and $state_id properties. |
||
49 | * |
||
50 | * If the $state array does not exist in the session, create it. |
||
51 | * |
||
52 | * The current implementation is borrowed directly from |
||
53 | * GridField_FormAction::getAttributes() 3.2.0-beta2. |
||
54 | */ |
||
55 | protected function updateState($grid) |
||
76 | |||
77 | /** |
||
78 | * Implements the GridField_HTMLProvider interface. |
||
79 | * |
||
80 | * @param GridField $grid |
||
81 | * @return array |
||
82 | */ |
||
83 | public function getHTMLFragments($grid) |
||
101 | |||
102 | /** |
||
103 | * Required by the GridField_ActionProvider interface. |
||
104 | * |
||
105 | * @param GridField $grid |
||
106 | * @return array |
||
107 | */ |
||
108 | public function getActions($grid) |
||
112 | |||
113 | /** |
||
114 | * Handle the action. |
||
115 | * |
||
116 | * It swithces the "state" flag and saves the data into a session |
||
117 | * variable for later reuse. |
||
118 | * |
||
119 | * @param GridField $grid The subject GridField instance |
||
120 | * @param string $action The action name (lowercase!) |
||
121 | * @param mixed $arguments Optional argument(s) for the action |
||
122 | * @param array $data Form data, if relevant |
||
123 | * |
||
124 | * @throws InvalidArgumentException |
||
125 | */ |
||
126 | public function handleAction(GridField $grid, $action, $arguments, $data) |
||
143 | |||
144 | /** |
||
145 | * Required by the GridField_DataManipulator interface. |
||
146 | * |
||
147 | * Disable pagination on the GridFieldPaginator component, if |
||
148 | * required by the current "state" flag. It must be called before |
||
149 | * GridFieldPaginator::getManipulatedData() to take effect, hence |
||
150 | * the requirement that GridFieldTogglePaginator must be added |
||
151 | * before GridFieldPaginator. |
||
152 | * |
||
153 | * @param GridField $grid |
||
154 | * @return SS_List |
||
155 | */ |
||
156 | public function getManipulatedData(GridField $grid, SS_List $list) |
||
165 | } |
||
166 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.