function opigno_certificate_entity_bundle_field_info in Opigno certificate 8
Same name and namespace in other branches
- 3.x opigno_certificate.module \opigno_certificate_entity_bundle_field_info()
Implements hook_entity_bundle_field_info().
File
- ./
opigno_certificate.module, line 130 - Contains opigno_certificate.module.
Code
function opigno_certificate_entity_bundle_field_info(EntityTypeInterface $entity_type, $bundle) {
$fields = [];
if ($entity_type
->id() === 'opigno_certificate' && $bundle == 'wysiwyg') {
$fields['body'] = FieldStorageDefinition::create('text_long')
->setLabel(t('Body'))
->setRequired(TRUE)
->setCardinality(1)
->setTranslatable(FALSE)
->setTargetbundle($bundle)
->setDisplayOptions('form', [
'type' => 'text_textarea',
'label' => 'hidden',
'settings' => [
'placeholder' => t('Message'),
],
])
->setDisplayOptions('view', [
'label' => 'hidden',
'type' => 'text_textfield',
'settings' => [],
'weight' => 0,
])
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
}
if ($entity_type
->id() == 'opigno_certificate' && $bundle == 'template') {
$fields['view_mode'] = FieldStorageDefinition::create('view_mode_selector')
->setLabel(t('View mode'))
->setRequired(TRUE)
->setCardinality(1)
->setTranslatable(FALSE)
->setTargetbundle($bundle)
->setDisplayOptions('form', [
'type' => 'opigno_certificate_view_mode_selector_select',
'label' => 'hidden',
'settings' => [],
])
->setDisplayOptions('view', [
'label' => 'hidden',
'type' => 'hidden',
'settings' => [],
'weight' => 0,
])
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', FALSE);
}
return $fields;
}