1 | <?php |
||
3 | class GridFieldMergeAction implements GridField_ColumnProvider, GridField_ActionProvider |
||
|
|||
4 | { |
||
5 | |||
6 | /** |
||
7 | * Cache results of records queries. This is useful for blogs |
||
8 | * with a lot of tags or categories. |
||
9 | * |
||
10 | * @var array |
||
11 | * |
||
12 | * @example |
||
13 | * array(1) { |
||
14 | * ["2d73dd8f18b8da3c8e5e75b6bee66d8d"]=> array(3) { |
||
15 | * [2]=> string(5) "tag2" |
||
16 | * [1]=> string(6) "tag1" |
||
17 | * [3]=> string(4) "tag3" |
||
18 | * } |
||
19 | * } |
||
20 | * The array key in the first level is made up of an md5 hash of the sql query, |
||
21 | * then the second level is made if up ID => tag name. |
||
22 | */ |
||
23 | protected static $cached_results = array(); |
||
24 | |||
25 | /** |
||
26 | * List of records to show in the MergeAction column. |
||
27 | * |
||
28 | * @var array|SS_List |
||
29 | */ |
||
30 | protected $records; |
||
31 | |||
32 | /** |
||
33 | * Type of parent DataObject (i.e BlogTag, BlogCategory). |
||
34 | * |
||
35 | * @var string |
||
36 | */ |
||
37 | protected $parentType; |
||
38 | |||
39 | /** |
||
40 | * Relationship method to reference parent (i.e BlogTags). |
||
41 | * |
||
42 | * @var string |
||
43 | */ |
||
44 | protected $parentMethod; |
||
45 | |||
46 | /** |
||
47 | * Relationship method to reference child (i.e BlogPosts). |
||
48 | * |
||
49 | * @var string |
||
50 | */ |
||
51 | protected $childMethod; |
||
52 | |||
53 | /** |
||
54 | * @param array|SS_List $records |
||
55 | * @param string $parentType |
||
56 | * @param string $parentMethod |
||
57 | * @param string $childMethod |
||
58 | */ |
||
59 | public function __construct($records = array(), $parentType, $parentMethod, $childMethod) |
||
66 | |||
67 | /** |
||
68 | * {@inheritdoc} |
||
69 | */ |
||
70 | public function augmentColumns($gridField, &$columns) |
||
78 | |||
79 | /** |
||
80 | * {@inheritdoc} |
||
81 | */ |
||
82 | public function getColumnsHandled($gridField) |
||
86 | |||
87 | /** |
||
88 | * {@inheritdoc} |
||
89 | */ |
||
90 | public function getColumnContent($gridField, $record, $columnName) |
||
138 | |||
139 | /** |
||
140 | * {@inheritdoc} |
||
141 | */ |
||
142 | public function getColumnAttributes($gridField, $record, $columnName) |
||
146 | |||
147 | /** |
||
148 | * {@inheritdoc} |
||
149 | */ |
||
150 | public function getColumnMetadata($gridField, $columnName) |
||
154 | |||
155 | /** |
||
156 | * {@inheritdoc} |
||
157 | */ |
||
158 | public function getActions($gridField) |
||
162 | |||
163 | /** |
||
164 | * {@inheritdoc} |
||
165 | */ |
||
166 | public function handleAction(GridField $gridField, $actionName, $arguments, $data) |
||
190 | } |
||
191 |
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.