I have a custom content entity created with
public static function baseFieldDefinitions(EntityTypeInterface $entity_type)
.
I just added a field to that entity with
- adding a new $fields['courriel'] = BaseFieldDefinition::create('email')
- creating hook.install file with
function association_update_8101()
{
\Drupal::entityDefinitionUpdateManager()->applyUpdates();
}
Running update.php has indeed added the field to the corresponding database table and I can access it with my code (for example, I store in that field a copy of user->mail.
But when I use CRUD forms for my Entity (i.e. canonical, add-form, edit-form or collection), I don't see the new field.
What did I miss?
[Edit] my hook.install is now:
function association_update_8101()
{
$storage_definition = BaseFieldDefinition::create('email')
->setLabel(t('Courriel'))
->setDescription(t('The email address of the Personne entity.'))
->setDefaultValue('')
->setReadOnly(TRUE);
\Drupal::entityDefinitionUpdateManager()
->installFieldStorageDefinition('courriel', 'association_personne', 'association_personne', $storage_definition);
}
I managed to run again update.php with success (at least with no errors): the table has now the new column (Courriel) but I still don't have my CRUD forms showing 'Courriel'.
Is there anything else I need to add to hook_update_8101 to have that done?