improvements-2.x-dev/modules/improvements_views/tests/modules/improvements_views_test/improvements_views_test.module
modules/improvements_views/tests/modules/improvements_views_test/improvements_views_test.module
<?php use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Field\BaseFieldDefinition; /** * Implements hook_theme(). */ function improvements_views_test_theme(): array { return [ 'views_view__test_total_rows_token' => [ 'base hook' => 'views_view', ], ]; } /** * Implements hook_views_data_alter(). */ function improvements_views_test_views_data_alter(array &$data): void { if (isset($data['comment_field_data'])) { $data['comment_field_data']['uid_is_registered'] = [ 'title' => t('Author is registered user'), 'title short' => t('Author is registered user'), 'real field' => 'uid', 'sort' => [ 'id' => 'greater_than', 'number' => 0, ], ]; } $data['node_field_data']['test_map_field_map'] = [ 'title' => 'Test map field (map)', 'title short' => 'Test map field (map)', 'real field' => 'test_map_field', 'entity field' => 'test_map_field', 'field' => [ 'id' => 'map', ], ]; } /** * Implements hook_entity_base_field_info(). */ function improvements_views_test_entity_base_field_info(EntityTypeInterface $entity_type): ?array { if ($entity_type->id() == 'node') { $fields = []; $fields['test_map_field'] = BaseFieldDefinition::create('map') ->setLabel('Test map field'); return $fields; } return NULL; }