function AliasingResourceTypeRepository::getFields
Same name in other branches
- 9 core/modules/jsonapi/tests/modules/jsonapi_test_field_aliasing/src/ResourceType/AliasingResourceTypeRepository.php \Drupal\jsonapi_test_field_aliasing\ResourceType\AliasingResourceTypeRepository::getFields()
- 8.9.x core/modules/jsonapi/tests/modules/jsonapi_test_field_aliasing/src/ResourceType/AliasingResourceTypeRepository.php \Drupal\jsonapi_test_field_aliasing\ResourceType\AliasingResourceTypeRepository::getFields()
- 11.x core/modules/jsonapi/tests/modules/jsonapi_test_field_aliasing/src/ResourceType/AliasingResourceTypeRepository.php \Drupal\jsonapi_test_field_aliasing\ResourceType\AliasingResourceTypeRepository::getFields()
Overrides ResourceTypeRepository::getFields
File
-
core/
modules/ jsonapi/ tests/ modules/ jsonapi_test_field_aliasing/ src/ ResourceType/ AliasingResourceTypeRepository.php, line 16
Class
- AliasingResourceTypeRepository
- Provides a repository of resource types with field names that can be aliased.
Namespace
Drupal\jsonapi_test_field_aliasing\ResourceTypeCode
protected function getFields(array $field_names, EntityTypeInterface $entity_type, $bundle) {
$fields = parent::getFields($field_names, $entity_type, $bundle);
foreach ($fields as $field_name => $field) {
if (str_starts_with($field_name, 'field_test_alias_')) {
$fields[$field_name] = $fields[$field_name]->withPublicName('field_test_alias');
}
}
return $fields;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.