- Issue created by @vlooi vlerke
- πΏπ¦South Africa vlooi vlerke
To fix this issue make the following changes
$fields['user_id'] = BaseFieldDefinition::create('entity_reference') ->setLabel(t('Authored by')) ->setDescription(t('The user ID of author of the Product entity.')) ->setRevisionable(TRUE) ->setSetting('target_type', 'user') ->setSetting('handler', 'default') ->setTranslatable(TRUE) - ->setDisplayOptions('view', [ - 'type' => 'hidden', - ]) - ->setDisplayOptions('form', [ - 'type' => 'hidden', - ]) ->setDisplayConfigurable('form', TRUE) ->setDisplayConfigurable('view', TRUE);
$fields['status'] = BaseFieldDefinition::create('boolean') ->setLabel(t('Publishing status')) ->setDescription(t('A boolean indicating whether the Product is published.')) ->setRevisionable(TRUE) ->setDefaultValue(TRUE) - ->setDisplayOptions('form', [ - 'type' => 'hidden', - ]); + ;
$fields['cost'] = BaseFieldDefinition::create('float') ->setLabel(t('Cost')) ->setDescription(t('Product cost.')) ->setRevisionable(TRUE) ->setDefaultValue(0) ->setDisplayOptions('view', [ 'label' => 'above', - 'type' => 'float', + 'type' => 'number_decimal', 'weight' => -3, ]) ->setDisplayConfigurable('form', TRUE) ->setDisplayConfigurable('view', TRUE) ->setRequired(FALSE);
$fields['store'] = BaseFieldDefinition::create('entity_reference') ->setLabel(t('Store')) ->setDescription(t('The store this product belongs to.')) ->setSetting('target_type', 'store') ->setSetting('handler', 'default') ->setRevisionable(TRUE) ->setDefaultValue('') ->setDisplayOptions('form', [ 'type' => 'entity_reference_select', 'weight' => -3, ]) - ->setDisplayOptions('view', [ - 'type' => 'hidden', - ]) ->setDisplayConfigurable('form', TRUE) ->setDisplayConfigurable('view', TRUE) ->setRequired(TRUE);