Skip to content
Snippets Groups Projects
Commit b56ab960 authored by Sadashiv Dalvi's avatar Sadashiv Dalvi
Browse files

Adding uuid field so that views work

parent 9e488b74
Branches
Tags 8.x-3.0-beta3
No related merge requests found
......@@ -82,3 +82,20 @@ function google_api_client_update_8002() {
$entity_type = \Drupal::entityTypeManager()->getDefinition('google_api_service_client');
\Drupal::entityDefinitionUpdateManager()->installEntityType($entity_type);
}
/**
* Create UUID field for Google Api Client.
*/
function google_api_client_update_8803() {
\Drupal::entityTypeManager()->clearCachedDefinitions();
$definition_manager = \Drupal::entityDefinitionUpdateManager();
// Create a new field definition.
$new_uuid_field = \Drupal\Core\Field\BaseFieldDefinition::create('uuid')
->setLabel(t('UUID'))
->setDescription(t('The Google Api Client UUID.'))
->setReadOnly(TRUE);
// Install the new definition.
$definition_manager->installFieldStorageDefinition('uuid', 'google_api_client', 'google_api_client', $new_uuid_field);
}
......@@ -88,6 +88,7 @@ use Drupal\Component\Serialization\Json;
* fieldable = TRUE,
* entity_keys = {
* "id" = "id",
* "uuid" = "uuid",
* "label" = "name",
* "owner" = "uid"
* },
......@@ -352,6 +353,11 @@ class GoogleApiClient extends ContentEntityBase implements GoogleApiClientInterf
])
->setDisplayConfigurable('view', TRUE);
$fields['uuid'] = BaseFieldDefinition::create('uuid')
->setLabel(t('UUID'))
->setDescription(t('The Google Api Client UUID.'))
->setReadOnly(TRUE);
$fields['name'] = BaseFieldDefinition::create('string')
->setLabel(t('Name'))
->setDescription(t('The name of the GoogleApiClient entity.'))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment