1 | <?php |
||
20 | abstract class ViewDeriverBase extends DeriverBase implements ContainerDeriverInterface { |
||
21 | /** |
||
22 | * The entity type manager. |
||
23 | * |
||
24 | * @var \Drupal\Core\Entity\EntityTypeManagerInterface |
||
25 | */ |
||
26 | protected $entityTypeManager; |
||
27 | |||
28 | /** |
||
29 | * The interface plugin manager to search for return type candidates. |
||
30 | * |
||
31 | * @var \Drupal\Component\Plugin\PluginManagerInterface |
||
32 | */ |
||
33 | protected $interfacePluginManager; |
||
34 | |||
35 | /** |
||
36 | * An key value pair of data tables and the entities they belong to. |
||
37 | * |
||
38 | * @var string[] |
||
39 | */ |
||
40 | protected $dataTables; |
||
41 | |||
42 | /** |
||
43 | * {@inheritdoc} |
||
44 | */ |
||
45 | public static function create(ContainerInterface $container, $basePluginId) { |
||
51 | |||
52 | /** |
||
53 | * Creates a ViewDeriver object. |
||
54 | * |
||
55 | * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager |
||
56 | * An entity type manager instance. |
||
57 | * @param \Drupal\Component\Plugin\PluginManagerInterface $interfacePluginManager |
||
58 | * The plugin manager for graphql interfaces. |
||
59 | */ |
||
60 | public function __construct( |
||
67 | |||
68 | /** |
||
69 | * Check if a pager is configured. |
||
70 | * |
||
71 | * @param \Drupal\views\Plugin\views\display\DisplayPluginInterface $display |
||
72 | * The display configuration. |
||
73 | * |
||
74 | * @return bool |
||
75 | * Flag indicating if the view is configured with a pager. |
||
76 | */ |
||
77 | protected function isPaged(DisplayPluginInterface $display) { |
||
81 | |||
82 | /** |
||
83 | * Get the configured default limit. |
||
84 | * |
||
85 | * @param \Drupal\views\Plugin\views\display\DisplayPluginInterface $display |
||
86 | * The display configuration. |
||
87 | * |
||
88 | * @return int |
||
89 | * The default limit. |
||
90 | */ |
||
91 | protected function getPagerLimit(DisplayPluginInterface $display) { |
||
97 | |||
98 | /** |
||
99 | * Get the configured default offset. |
||
100 | * |
||
101 | * @param \Drupal\views\Plugin\views\display\DisplayPluginInterface $display |
||
102 | * The display configuration. |
||
103 | * |
||
104 | * @return int |
||
105 | * The default offset. |
||
106 | */ |
||
107 | protected function getPagerOffset(DisplayPluginInterface $display) { |
||
113 | |||
114 | /** |
||
115 | * Retrieves the entity type id of an entity by its base or data table. |
||
116 | * |
||
117 | * @param string $table |
||
118 | * The base or data table of an entity. |
||
119 | * |
||
120 | * @return string |
||
121 | * The id of the entity type that the given base table belongs to. |
||
122 | */ |
||
123 | protected function getEntityTypeByTable($table) { |
||
139 | |||
140 | /** |
||
141 | * Retrieves the type the view's rows resolve to. |
||
142 | * |
||
143 | * @param \Drupal\views\ViewEntityInterface $view |
||
144 | * The view entity. |
||
145 | * @param $displayId |
||
146 | * The id of the current display. |
||
147 | * |
||
148 | * @return null|string |
||
149 | * The name of the type or NULL if the type could not be derived. |
||
150 | */ |
||
151 | protected function getRowResolveType(ViewEntityInterface $view, $displayId) { |
||
192 | |||
193 | /** |
||
194 | * Check if a certain interface exists. |
||
195 | * |
||
196 | * @param string $interface |
||
197 | * The GraphQL interface name. |
||
198 | * |
||
199 | * @return bool |
||
200 | * Boolean flag indicating if the interface exists. |
||
201 | */ |
||
202 | protected function interfaceExists($interface) { |
||
207 | |||
208 | /** |
||
209 | * Returns a view display object. |
||
210 | * |
||
211 | * @param \Drupal\views\ViewEntityInterface $view |
||
212 | * The view object. |
||
213 | * @param string $displayId |
||
214 | * The display ID to use. |
||
215 | * |
||
216 | * @return \Drupal\views\Plugin\views\display\DisplayPluginInterface |
||
217 | * The view display object. |
||
218 | */ |
||
219 | protected function getViewDisplay(ViewEntityInterface $view, $displayId) { |
||
224 | |||
225 | /** |
||
226 | * Returns a view style object. |
||
227 | * |
||
228 | * @param \Drupal\views\ViewEntityInterface $view |
||
229 | * The view object. |
||
230 | * @param string $displayId |
||
231 | * The display ID to use. |
||
232 | * |
||
233 | * @return \Drupal\views\Plugin\views\style\StylePluginBase |
||
234 | * The view style object. |
||
235 | */ |
||
236 | protected function getViewStyle(ViewEntityInterface $view, $displayId) { |
||
241 | |||
242 | /** |
||
243 | * Returns cache metadata plugin definitions. |
||
244 | * |
||
245 | * @param \Drupal\views\ViewEntityInterface $view |
||
246 | * The view object. |
||
247 | * |
||
248 | * @return array |
||
249 | * The cache metadata definitions for the plugin definition. |
||
250 | */ |
||
251 | protected function getCacheMetadataDefinition(ViewEntityInterface $view) { |
||
258 | |||
259 | /** |
||
260 | * Returns information about view arguments (contextual filters). |
||
261 | * |
||
262 | * @param array $viewArguments |
||
263 | * The "arguments" option of a view display. |
||
264 | * |
||
265 | * @return array |
||
266 | * Arguments information keyed by the argument ID. Subsequent array keys: |
||
267 | * - index: argument index. |
||
268 | * - entity_type: target entity type. |
||
269 | * - bundles: target bundles (can be empty). |
||
270 | */ |
||
271 | protected function getArgumentsInfo(array $viewArguments) { |
||
305 | } |
||
306 |