You are here

function opigno_calendar_event_group_entity_base_field_info in Opigno calendar event 8

Same name and namespace in other branches
  1. 3.x modules/opigno_calendar_event_group/opigno_calendar_event_group.module \opigno_calendar_event_group_entity_base_field_info()

Implements hook_entity_base_field_info().

File

modules/opigno_calendar_event_group/opigno_calendar_event_group.module, line 34
Main file for the "Opigno Calendar event group" module.

Code

function opigno_calendar_event_group_entity_base_field_info(EntityTypeInterface $entity_type) {
  $fields = [];
  if ($entity_type
    ->id() === CalendarEventInterface::ENTITY_TYPE_ID) {
    $fields['display_groups'] = BaseFieldDefinition::create('entity_reference')
      ->setLabel(new TranslatableMarkup('Calendar display groups'))
      ->setDescription(new TranslatableMarkup('Associate the calendar event to related groups.'))
      ->setRevisionable(TRUE)
      ->setSetting('target_type', 'group')
      ->setTranslatable(FALSE)
      ->setCardinality(BaseFieldDefinition::CARDINALITY_UNLIMITED);
  }
  return $fields;
}