1 | <?php namespace Anomaly\Streams\Platform\Field\Table; |
||
14 | class FieldTableBuilder extends TableBuilder |
||
15 | { |
||
16 | |||
17 | /** |
||
18 | * The locked flag. |
||
19 | * |
||
20 | * @var bool |
||
21 | */ |
||
22 | protected $locked = false; |
||
23 | |||
24 | /** |
||
25 | * The related stream instance. |
||
26 | * |
||
27 | * @var null|StreamInterface |
||
28 | */ |
||
29 | protected $stream = null; |
||
30 | |||
31 | /** |
||
32 | * The stream namespace. |
||
33 | * |
||
34 | * @var null|string |
||
35 | */ |
||
36 | protected $namespace = null; |
||
37 | |||
38 | /** |
||
39 | * The table model. |
||
40 | * |
||
41 | * @var string |
||
42 | */ |
||
43 | protected $model = 'Anomaly\Streams\Platform\Field\FieldModel'; |
||
44 | |||
45 | /** |
||
46 | * The table filters. |
||
47 | * |
||
48 | * @var array |
||
49 | */ |
||
50 | protected $filters = [ |
||
51 | 'search' => [ |
||
52 | 'columns' => [ |
||
53 | 'name', |
||
54 | 'slug', |
||
55 | ], |
||
56 | ], |
||
57 | ]; |
||
58 | |||
59 | /** |
||
60 | * The table columns. |
||
61 | * |
||
62 | * @var array |
||
63 | */ |
||
64 | protected $columns = [ |
||
65 | [ |
||
66 | 'heading' => 'streams::field.name.name', |
||
67 | 'value' => 'entry.name', |
||
68 | ], |
||
69 | [ |
||
70 | 'heading' => 'streams::field.slug.name', |
||
71 | 'value' => 'entry.slug', |
||
72 | ], |
||
73 | [ |
||
74 | 'heading' => 'streams::field.type.name', |
||
75 | 'wrapper' => '{value}::addon.name', |
||
76 | 'value' => 'entry.type', |
||
77 | ], |
||
78 | ]; |
||
79 | |||
80 | /** |
||
81 | * The table buttons. |
||
82 | * |
||
83 | * @var array |
||
84 | */ |
||
85 | protected $buttons = [ |
||
86 | 'edit', |
||
87 | ]; |
||
88 | |||
89 | /** |
||
90 | * The table actions. |
||
91 | * |
||
92 | * @var array |
||
93 | */ |
||
94 | protected $actions = [ |
||
95 | 'prompt', |
||
96 | ]; |
||
97 | |||
98 | /** |
||
99 | * The table options. |
||
100 | * |
||
101 | * @var array |
||
102 | */ |
||
103 | protected $options = [ |
||
104 | 'order_by' => [ |
||
105 | 'slug' => 'ASC', |
||
106 | ], |
||
107 | ]; |
||
108 | |||
109 | /** |
||
110 | * Limit to the stream's namespace. |
||
111 | * |
||
112 | * @param Builder $query |
||
113 | */ |
||
114 | public function onQuerying(Builder $query) |
||
122 | |||
123 | /** |
||
124 | * Get the lock flag. |
||
125 | * |
||
126 | * @return bool |
||
127 | */ |
||
128 | public function getLocked() |
||
132 | |||
133 | /** |
||
134 | * Set the lock flag. |
||
135 | * |
||
136 | * @param $locked |
||
137 | * @return $this |
||
138 | */ |
||
139 | public function setLocked($locked) |
||
145 | |||
146 | /** |
||
147 | * Get the stream. |
||
148 | * |
||
149 | * @return StreamInterface|null |
||
150 | */ |
||
151 | public function getStream() |
||
155 | |||
156 | /** |
||
157 | * Return the related stream's namespace. |
||
158 | * |
||
159 | * @return string |
||
160 | */ |
||
161 | protected function getStreamNamespace() |
||
167 | |||
168 | /** |
||
169 | * Set the stream. |
||
170 | * |
||
171 | * @param StreamInterface $stream |
||
172 | * @return $this |
||
173 | */ |
||
174 | public function setStream(StreamInterface $stream) |
||
180 | |||
181 | /** |
||
182 | * Get the namespace. |
||
183 | * |
||
184 | * @return null|string |
||
185 | */ |
||
186 | public function getNamespace() |
||
190 | |||
191 | /** |
||
192 | * Set the namespace. |
||
193 | * |
||
194 | * @param $namespace |
||
195 | * @return $this |
||
196 | */ |
||
197 | public function setNamespace($namespace) |
||
203 | } |
||
204 |