Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
google_api_client
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
google_api_client
Commits
b56ab960
Commit
b56ab960
authored
4 years ago
by
Sadashiv Dalvi
Browse files
Options
Downloads
Patches
Plain Diff
Adding uuid field so that views work
parent
9e488b74
Branches
Branches containing commit
Tags
8.x-3.0-beta3
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
google_api_client.install
+17
-0
17 additions, 0 deletions
google_api_client.install
src/Entity/GoogleApiClient.php
+6
-0
6 additions, 0 deletions
src/Entity/GoogleApiClient.php
with
23 additions
and
0 deletions
google_api_client.install
+
17
−
0
View file @
b56ab960
...
...
@@ -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
);
}
This diff is collapsed.
Click to expand it.
src/Entity/GoogleApiClient.php
+
6
−
0
View file @
b56ab960
...
...
@@ -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.'
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment