function opigno_certificate_entity_bundle_field_info in Opigno certificate 3.x
Same name and namespace in other branches
- 8 opigno_certificate.module \opigno_certificate_entity_bundle_field_info()
Implements hook_entity_bundle_field_info().
File
- ./
opigno_certificate.module, line 137 - 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') {
return;
$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;
}