You are here

function paragraphs_library_update_8003 in Paragraphs 8

Add revision log field.

File

modules/paragraphs_library/paragraphs_library.install, line 137
Install/Update hooks for paragraphs library.

Code

function paragraphs_library_update_8003() {
  $entity_definition_update_manager = \Drupal::entityDefinitionUpdateManager();
  $entity_type = $entity_definition_update_manager
    ->getEntityType('paragraphs_library_item');
  $storage_definition = BaseFieldDefinition::create('string_long')
    ->setLabel(t('Revision log message'))
    ->setDescription(t('The log entry explaining the changes in this revision.'))
    ->setRevisionable(TRUE)
    ->setDisplayOptions('form', [
    'type' => 'string_textarea',
    'weight' => 25,
    'settings' => [
      'rows' => 4,
    ],
  ]);
  \Drupal::entityDefinitionUpdateManager()
    ->installFieldStorageDefinition('revision_log', $entity_type
    ->id(), 'paragraphs_library_item', $storage_definition);
}