- Issue created by @abdulaziz zaid
I use this hook_entity_base_field_info
for creating a user field type boolean and it is not working if I enable the module from Extend, But it is working if I enable it from drush.
The hook does not work if Enable Single Directory Components module (Core (Experimental).
Drupal: 10.1.7
PHP: 8.1.18
1- Enable Single Directory Components module (Core (Experimental).
2- Create a custom module and add the following code
/**
* Implements hook_entity_base_field_info().
*/
function YOUR-MODULE_entity_base_field_info(EntityTypeInterface $entity_type) {
$fields = [];
if ($entity_type->id() === 'user') {
$fields['status_example'] = BaseFieldDefinition::create('boolean')
->setLabel(t('Active'))
->setDescription(t('Example boolean field'))
->setRevisionable(TRUE)
->setTranslatable(TRUE)
->setDisplayOptions('form', [
'type' => 'boolean_checkbox',
'settings' => [
'display_label' => TRUE,
],
])
->setDisplayConfigurable('form', TRUE);
}
return $fields;
}
2- try to enable the module from Extend and check on table users_field_data
the column is not showing.
3- try to enable the module using drush en <YOUR-MODULE>
and check on table users_field_data
the column is showing.
.
.
.
.
.
.
.
Active
10.1 β¨