You are here

function rate_update_8201 in Rate 8.2

Adds the rate_widget column to the votingapi_vote table.

File

./rate.install, line 223
Installation/Uninstallation functions for rate module.

Code

function rate_update_8201(&$sandbox) {
  $storage = BaseFieldDefinition::create('string')
    ->setLabel(t('Rate widget'))
    ->setDescription(t('Holds the Rate field name.'))
    ->setRevisionable(FALSE)
    ->setCustomStorage(FALSE)
    ->setTranslatable(FALSE)
    ->setRequired(FALSE)
    ->setPropertyConstraints('value', [
    'Length' => [
      'max' => FieldStorageConfig::NAME_MAX_LENGTH,
    ],
  ]);
  \Drupal::entityDefinitionUpdateManager()
    ->installFieldStorageDefinition('rate_widget', 'vote', 'rate', $storage);
}