diff --git a/web/modules/custom/joinup_core/joinup_core.install b/web/modules/custom/joinup_core/joinup_core.install index 1f31d3af15..dd6dba3ac1 100644 --- a/web/modules/custom/joinup_core/joinup_core.install +++ b/web/modules/custom/joinup_core/joinup_core.install @@ -6,6 +6,7 @@ */ use Drupal\Core\Database\Database; +use Drupal\Core\Field\BaseFieldDefinition; use Drupal\Core\Site\Settings; use Drupal\sparql_entity_storage\Entity\SparqlMapping; use Drupal\user\Entity\User; @@ -295,3 +296,26 @@ function joinup_core_update_8109() { $entity_type = \Drupal::entityTypeManager()->getDefinition('solr_field_type'); \Drupal::entityDefinitionUpdateManager()->installEntityType($entity_type); } + +/** + * Install the 'Published on' field storage definition. + */ +function joinup_core_update_8110() { + \Drupal::entityDefinitionUpdateManager()->installFieldStorageDefinition( + 'published_at', + 'node', + 'publication_date', + BaseFieldDefinition::create('published_at') + ->setLabel(t('Published on')) + ->setDescription(t('Keep the publication timestamp for each node.')) + ->setRevisionable(TRUE) + ->setTranslatable(TRUE) + ->setDisplayOptions('view', ['type' => 'hidden']) + ->setDisplayConfigurable('view', TRUE) + ->setDisplayOptions('form', [ + 'type' => 'publication_date_timestamp', + 'weight' => 10, + ]) + ->setDisplayConfigurable('form', TRUE) + ); +}