My site allows users to upload images and add title and description to it. So I make a new class which extends
ContentEntityBase. In its
baseFieldDefinitions() method, I put an image field beside title and description fields:
$fields['image'] = BaseFieldDefinition::create('image') ->setLabel(t('Image')) ->setRequired(TRUE);
I expect to see a file/image upload control in the add/edit form, but I don't see it. I see only the title and description textboxes.
I tried to find "create('image')" in all Drupal source code but didn't see any examples. So I don't know if creating an image field like this is the proper way or not?