3

I created a entity.

$fields['supplemental'] = BaseFieldDefinition::create('text_long')
                ->setLabel(t('Supplemental'))
                ->setDescription(t('Answer description.'))
                ->setDisplayOptions('view', array(
                    'label' => 'hidden',
                    'type' => 'text_default',
                    'weight' => -3,
                ))
                ->setDisplayOptions('form', array(
                    'type' => 'text_textfield',
                    'weight' => -3,
                ))
                //->setRequired(TRUE)
                ->setDisplayConfigurable('form', TRUE)
                ->setDisplayConfigurable('view', TRUE);

And I'm saving data into this entity's field like

$mcq = Mcq::create(array(
           'supplemental__value' => $value->supplemental,
            'supplemental__format'=>'basic_html',
        )); 
$mcq->save();

Issue is all fields gets populated except of type 'text_long'. Am I missing something or there is any other way of populating entity field values.

1 Answer 1

3

After realising few minutes later, the column name should be supplemental not supplemental__value.

I was mapping content by looking into database columns which was wrong.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.