Skip to content

Instantly share code, notes, and snippets.

@googletorp
Created November 1, 2015 21:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save googletorp/31a4dd5fbb957847724c to your computer and use it in GitHub Desktop.
Save googletorp/31a4dd5fbb957847724c to your computer and use it in GitHub Desktop.
Drupal migration example
// Update the table.
$storage_definition = BaseFieldDefinition::create('string_long')
->setLabel(t('Quote'))
->setDescription(t('The quote, always treated as non-markup plain text.'))
->setRequired(TRUE)
->setTranslatable(TRUE)
->setDefaultValue('')
->setDisplayOptions('view', array(
'label' => 'hidden',
'type' => 'rd_quote',
'weight' => -5,
))
->setDisplayOptions('form', [
'type' => 'string_textarea',
'weight' => -5,
'settings' => [
'rows' => 8,
],
])
->setDisplayConfigurable('form', TRUE);
$storage_definition->setName('quote')
->setTargetEntityTypeId('rd_quote')
->setProvider('rd_quote')
->setTargetBundle(NULL);
\Drupal::entityDefinitionUpdateManager()->updateFieldStorageDefinition($storage_definition);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment