-
-
Notifications
You must be signed in to change notification settings - Fork 560
/
module.views.inc.twig
40 lines (32 loc) · 1.1 KB
/
module.views.inc.twig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
{% extends "base/file.php.twig" %}
{% block file_path %}{{ module }}\{{ module }}.views.inc.{% endblock %}
{% block extra_info %} * Provide a custom views field data that isn't tied to any other module.{% endblock %}
{% block use_class %}
use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\Sql\SqlContentEntityStorage;
use Drupal\Core\Render\Markup;
use Drupal\field\FieldConfigInterface;
use Drupal\field\FieldStorageConfigInterface;
use Drupal\system\ActionConfigEntityInterface;
{% endblock %}
{% block file_methods %}
/**
* Implements hook_views_data().
*/
function {{module}}_views_data() {
$data['views']['table']['group'] = t('Custom Global');
$data['views']['table']['join'] = [
// #global is a special flag which allows a table to appear all the time.
'#global' => array[],
];
$data['views']['{{ class_machine_name }}'] = [
'title' => t('{{ title }}'),
'help' => t('{{ description }}'),
'field' => [
'id' => '{{ class_machine_name }}',
],
];
return $data;
}
{% endblock %}