public static function Meeting::baseFieldDefinitions in Opigno Moxtra 8
Same name and namespace in other branches
- 3.x src/Entity/Meeting.php \Drupal\opigno_moxtra\Entity\Meeting::baseFieldDefinitions()
Provides base field definitions for an entity type.
Implementations typically use the class \Drupal\Core\Field\BaseFieldDefinition for creating the field definitions; for example a 'name' field could be defined as the following:
$fields['name'] = BaseFieldDefinition::create('string')
->setLabel(t('Name'));
By definition, base fields are fields that exist for every bundle. To provide definitions for fields that should only exist on some bundles, use \Drupal\Core\Entity\FieldableEntityInterface::bundleFieldDefinitions().
The definitions returned by this function can be overridden for all bundles by hook_entity_base_field_info_alter() or overridden on a per-bundle basis via 'base_field_override' configuration entities.
Parameters
\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type definition. Useful when a single class is used for multiple, possibly dynamic entity types.
Return value
\Drupal\Core\Field\FieldDefinitionInterface[] An array of base field definitions for the entity type, keyed by field name.
Overrides ContentEntityBase::baseFieldDefinitions
See also
\Drupal\Core\Entity\EntityFieldManagerInterface::getFieldDefinitions()
\Drupal\Core\Entity\FieldableEntityInterface::bundleFieldDefinitions()
File
- src/
Entity/ Meeting.php, line 346
Class
- Meeting
- Defines the Workspace entity.
Namespace
Drupal\opigno_moxtra\EntityCode
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
$fields['id'] = BaseFieldDefinition::create('integer')
->setLabel(t('ID'))
->setDescription(t('The ID of the Meeting entity.'))
->setReadOnly(TRUE);
$fields['uuid'] = BaseFieldDefinition::create('uuid')
->setLabel(t('UUID'))
->setDescription(t('The UUID of the Meeting entity.'))
->setReadOnly(TRUE);
$fields['user_id'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Owner'))
->setDescription(t('The owner of the Meeting entity.'))
->setSettings([
'target_type' => 'user',
'handler' => 'default',
])
->setReadOnly(TRUE);
$fields['title'] = BaseFieldDefinition::create('string')
->setLabel(t('Title'))
->setDescription(t('The title of the Meeting entity.'))
->setSettings([
'default_value' => '',
'max_length' => 255,
'text_processing' => 0,
])
->setRequired(TRUE)
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
$fields['binder_id'] = BaseFieldDefinition::create('string')
->setLabel(t('Binder ID'))
->setDescription(t('The ID of the Moxtra binder of the Meeting entity.'))
->setSettings([
'max_length' => 255,
'text_processing' => 0,
]);
$fields['session_key'] = BaseFieldDefinition::create('string')
->setLabel(t('Session key'))
->setDescription(t('The session key of the Moxtra binder of the Meeting entity.'))
->setSettings([
'max_length' => 255,
'text_processing' => 0,
]);
$fields['date'] = BaseFieldDefinition::create('daterange')
->setName('date')
->setLabel(t('Date'))
->setRequired(TRUE)
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
$fields['training'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Related training'))
->setDescription(t('The related training of the Meeting entity.'))
->setSettings([
'target_type' => 'group',
'handler' => 'default:group',
'handler_settings' => [
'target_bundles' => [
'learning_path' => 'learning_path',
],
'sort' => [
'field' => '_none',
],
],
])
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
$fields['calendar_event'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Related calendar event'))
->setDescription(t('The related calendar event of the Meeting entity.'))
->setSettings([
'target_type' => 'opigno_calendar_event',
'handler' => 'default',
]);
$fields['members'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Members'))
->setDescription(t('The members of the Meeting entity.'))
->setSettings([
'target_type' => 'user',
'handler' => 'default',
])
->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED);
$fields['notified_members'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Notified Members'))
->setDescription(t('Members of the Meeting entity that received notification by email.'))
->setSettings([
'target_type' => 'user',
'handler' => 'default',
])
->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED);
return $fields;
}