only in patch2: unchanged: --- a/bookable_calendar.install +++ b/bookable_calendar.install @@ -31,8 +31,8 @@ function bookable_calendar_requirements($phase) { if ($phase == 'runtime') { $value = mt_rand(0, 100); $requirements['bookable_calendar_status'] = [ - 'title' => t('Bookable Calendar status'), - 'value' => t('Bookable Calendar value: @value', ['@value' => $value]), + 'title' => $this->t('Bookable Calendar status'), + 'value' => $this->t('Bookable Calendar value: @value', ['@value' => $value]), 'severity' => $value > 50 ? REQUIREMENT_INFO : REQUIREMENT_WARNING, ]; } @@ -59,8 +59,8 @@ function bookable_calendar_update_8102() { $field_storage_definition = BaseFieldDefinition::create('text_long') ->setRevisionable(TRUE) ->setTranslatable(TRUE) - ->setLabel(t('Success message')) - ->setDescription(t('Message displayed after a sucessful registration.')); + ->setLabel($this->t('Success message')) + ->setDescription($this->t('Message displayed after a sucessful registration.')); \Drupal::entityDefinitionUpdateManager() ->installFieldStorageDefinition('success_message', 'bookable_calendar', 'bookable_calendar', $field_storage_definition); } @@ -71,8 +71,8 @@ function bookable_calendar_update_8102() { function bookable_calendar_update_8103() { $field_storage_definition = BaseFieldDefinition::create('boolean') ->setRevisionable(TRUE) - ->setLabel(t('Treat Slots as Parties')) - ->setDescription(t('This will change the math of "Max Slots" to "Max Parties". This will allow you to only have 3 different groups claim a slot but each group can have as big of a party as your Max Party Size limit.')) + ->setLabel($this->t('Treat Slots as Parties')) + ->setDescription($this->t('This will change the math of "Max Slots" to "Max Parties". This will allow you to only have 3 different groups claim a slot but each group can have as big of a party as your Max Party Size limit.')) ->setDefaultValue(FALSE) ->setSetting('on_label', 'Treat Slots as Parties'); \Drupal::entityDefinitionUpdateManager() @@ -84,21 +84,21 @@ function bookable_calendar_update_8103() { */ function bookable_calendar_update_8104() { $field_storage_definition = BaseFieldDefinition::create('boolean') - ->setLabel(t('Override Default User Email')) - ->setDescription(t('Text in the email is editable on the main settings page, if you want different text per calendar you will need to select this')); + ->setLabel($this->t('Override Default User Email')) + ->setDescription($this->t('Text in the email is editable on the main settings page, if you want different text per calendar you will need to select this')); \Drupal::entityDefinitionUpdateManager() ->installFieldStorageDefinition('notification_email_override', 'bookable_calendar', 'bookable_calendar', $field_storage_definition); $field_storage_definition = BaseFieldDefinition::create('string') - ->setLabel(t('User Email Subject')) - ->setDescription(t('The subject of the email sent to the user if Override Default User Email is set')) + ->setLabel($this->t('User Email Subject')) + ->setDescription($this->t('The subject of the email sent to the user if Override Default User Email is set')) ->setSetting('max_length', 255); \Drupal::entityDefinitionUpdateManager() ->installFieldStorageDefinition('notification_email_subject', 'bookable_calendar', 'bookable_calendar', $field_storage_definition); $field_storage_definition = BaseFieldDefinition::create('text_long') - ->setLabel(t('User Email Body')) - ->setDescription(t('The body of the email sent to the user if Override Default User Email is set')); + ->setLabel($this->t('User Email Body')) + ->setDescription($this->t('The body of the email sent to the user if Override Default User Email is set')); \Drupal::entityDefinitionUpdateManager() ->installFieldStorageDefinition('notification_email_body', 'bookable_calendar', 'bookable_calendar', $field_storage_definition); } @@ -108,8 +108,8 @@ function bookable_calendar_update_8104() { */ function bookable_calendar_update_8105() { $field_storage_definition = BaseFieldDefinition::create('boolean') - ->setLabel(t('Checked In')) - ->setDescription(t('Whether or not this user has showed up to their booked event')) + ->setLabel($this->t('Checked In')) + ->setDescription($this->t('Whether or not this user has showed up to their booked event')) ->setDefaultValue(FALSE); \Drupal::entityDefinitionUpdateManager() ->installFieldStorageDefinition('checked_in', 'booking_contact', 'booking_contact', $field_storage_definition); @@ -120,8 +120,8 @@ function bookable_calendar_update_8105() { */ function bookable_calendar_update_8106() { $field_storage_definition = BaseFieldDefinition::create('integer') - ->setLabel(t('Slots')) - ->setDescription(t('The number of available slots for this instance. If empty (NB not zero), will use calendar\'s defaults.')) + ->setLabel($this->t('Slots')) + ->setDescription($this->t('The number of available slots for this instance. If empty (NB not zero), will use calendar\'s defaults.')) ->setCardinality(1) ->setDefaultValue(NULL); \Drupal::entityDefinitionUpdateManager() only in patch2: unchanged: --- a/src/Entity/BookableCalendar.php +++ b/src/Entity/BookableCalendar.php @@ -111,8 +111,8 @@ class BookableCalendar extends RevisionableContentEntityBase implements Bookable $fields['title'] = BaseFieldDefinition::create('string') ->setRevisionable(TRUE) ->setTranslatable(TRUE) - ->setLabel(t('Title')) - ->setDescription(t('The title of the bookable calendar entity.')) + ->setLabel($this->t('Title')) + ->setDescription($this->t('The title of the bookable calendar entity.')) ->setRequired(TRUE) ->setSetting('max_length', 255) ->setDisplayOptions('form', [ @@ -130,8 +130,8 @@ class BookableCalendar extends RevisionableContentEntityBase implements Bookable $fields['description'] = BaseFieldDefinition::create('text_long') ->setRevisionable(TRUE) ->setTranslatable(TRUE) - ->setLabel(t('Description')) - ->setDescription(t('A description of the bookable calendar.')) + ->setLabel($this->t('Description')) + ->setDescription($this->t('A description of the bookable calendar.')) ->setDisplayOptions('form', [ 'type' => 'text_textarea', 'weight' => -9, @@ -147,8 +147,8 @@ class BookableCalendar extends RevisionableContentEntityBase implements Bookable $fields['success_message'] = BaseFieldDefinition::create('text_long') ->setRevisionable(TRUE) ->setTranslatable(TRUE) - ->setLabel(t('Success message')) - ->setDescription(t('Message displayed after a sucessful registration.')) + ->setLabel($this->t('Success message')) + ->setDescription($this->t('Message displayed after a sucessful registration.')) ->setDisplayOptions('form', [ 'type' => 'text_textarea', 'weight' => -8, @@ -157,8 +157,8 @@ class BookableCalendar extends RevisionableContentEntityBase implements Bookable ->setDisplayConfigurable('view', FALSE); $fields['notification_email'] = BaseFieldDefinition::create('boolean') - ->setLabel(t('User Notification Email')) - ->setDescription(t('If enabled users will get a notification email when they book an opening.')) + ->setLabel($this->t('User Notification Email')) + ->setDescription($this->t('If enabled users will get a notification email when they book an opening.')) ->setDefaultValue(TRUE) ->setDisplayOptions('form', [ 'type' => 'boolean_checkbox', @@ -171,8 +171,8 @@ class BookableCalendar extends RevisionableContentEntityBase implements Bookable ->setDisplayConfigurable('view', FALSE); $fields['notification_email_override'] = BaseFieldDefinition::create('boolean') - ->setLabel(t('Override Default User Email')) - ->setDescription(t('Text in the email is editable on the main settings page, if you want different text per calendar you will need to select this')) + ->setLabel($this->t('Override Default User Email')) + ->setDescription($this->t('Text in the email is editable on the main settings page, if you want different text per calendar you will need to select this')) ->setDisplayOptions('form', [ 'type' => 'boolean_checkbox', 'settings' => [ @@ -184,8 +184,8 @@ class BookableCalendar extends RevisionableContentEntityBase implements Bookable ->setDisplayConfigurable('view', FALSE); $fields['notification_email_subject'] = BaseFieldDefinition::create('string') - ->setLabel(t('User Email Subject')) - ->setDescription(t('The subject of the email sent to the user if Override Default User Email is set')) + ->setLabel($this->t('User Email Subject')) + ->setDescription($this->t('The subject of the email sent to the user if Override Default User Email is set')) ->setSetting('max_length', 255) ->setDisplayOptions('form', [ 'type' => 'string_textfield', @@ -194,8 +194,8 @@ class BookableCalendar extends RevisionableContentEntityBase implements Bookable ->setDisplayConfigurable('form', TRUE); $fields['notification_email_body'] = BaseFieldDefinition::create('text_long') - ->setLabel(t('User Email Body')) - ->setDescription(t('The body of the email sent to the user if Override Default User Email is set')) + ->setLabel($this->t('User Email Body')) + ->setDescription($this->t('The body of the email sent to the user if Override Default User Email is set')) ->setDisplayOptions('form', [ 'type' => 'text_textarea', 'weight' => -5, @@ -203,8 +203,8 @@ class BookableCalendar extends RevisionableContentEntityBase implements Bookable ->setDisplayConfigurable('form', TRUE); $fields['admin_notification_email'] = BaseFieldDefinition::create('boolean') - ->setLabel(t('Admin Notification Emails')) - ->setDescription(t('If enabled admins will get a notification email on each booking.')) + ->setLabel($this->t('Admin Notification Emails')) + ->setDescription($this->t('If enabled admins will get a notification email on each booking.')) ->setDefaultValue(TRUE) ->setDisplayOptions('form', [ 'type' => 'boolean_checkbox', @@ -217,8 +217,8 @@ class BookableCalendar extends RevisionableContentEntityBase implements Bookable ->setDisplayConfigurable('view', FALSE); $fields['notify_email_recipient_role'] = BaseFieldDefinition::create('entity_reference') - ->setLabel(t('Notification Email Recipient Role')) - ->setDescription(t('Send email notifications on bookings to the following roles.')) + ->setLabel($this->t('Notification Email Recipient Role')) + ->setDescription($this->t('Send email notifications on bookings to the following roles.')) ->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED) ->setSettings([ 'target_type' => 'user_role' @@ -236,8 +236,8 @@ class BookableCalendar extends RevisionableContentEntityBase implements Bookable ->setDisplayConfigurable('view', FALSE); $fields['notify_email_recipients'] = BaseFieldDefinition::create('email') - ->setLabel(t('Notification Email Recipients')) - ->setDescription(t('The email address, or addresses one per line to receive the emails on bookings.')) + ->setLabel($this->t('Notification Email Recipients')) + ->setDescription($this->t('The email address, or addresses one per line to receive the emails on bookings.')) ->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED) ->setDisplayOptions('form', [ 'type' => 'email_default', @@ -252,8 +252,8 @@ class BookableCalendar extends RevisionableContentEntityBase implements Bookable ->setDisplayConfigurable('view', FALSE); $fields['max_party_size'] = BaseFieldDefinition::create('integer') - ->setLabel(t('Max Party Size')) - ->setDescription(t('What is the largest amount of bookings a single user can claim per opening. This limits a single user from claiming all 10 to themselves.')) + ->setLabel($this->t('Max Party Size')) + ->setDescription($this->t('What is the largest amount of bookings a single user can claim per opening. This limits a single user from claiming all 10 to themselves.')) ->setDisplayOptions('form', [ 'type' => 'number', 'settings' => [ @@ -265,8 +265,8 @@ class BookableCalendar extends RevisionableContentEntityBase implements Bookable ->setDisplayConfigurable('view', FALSE); $fields['slots_per_opening'] = BaseFieldDefinition::create('integer') - ->setLabel(t('Slots Per Opening')) - ->setDescription(t("The amount of Bookings that can claim a single opening. For example if your event has hour long openings you let people register for and you can handle 10 people per hour set this field to '10.'")) + ->setLabel($this->t('Slots Per Opening')) + ->setDescription($this->t("The amount of Bookings that can claim a single opening. For example if your event has hour long openings you let people register for and you can handle 10 people per hour set this field to '10.'")) ->setRequired(TRUE) ->setDefaultValue(1) ->setDisplayOptions('form', [ @@ -281,8 +281,8 @@ class BookableCalendar extends RevisionableContentEntityBase implements Bookable $fields['slots_as_parties'] = BaseFieldDefinition::create('boolean') ->setRevisionable(TRUE) - ->setLabel(t('Treat Slots as Parties')) - ->setDescription(t('This will change the math of "Max Slots" to "Max Parties". This will allow you to only have 3 different groups claim a slot but each group can have as big of a party as your Max Party Size limit.')) + ->setLabel($this->t('Treat Slots as Parties')) + ->setDescription($this->t('This will change the math of "Max Slots" to "Max Parties". This will allow you to only have 3 different groups claim a slot but each group can have as big of a party as your Max Party Size limit.')) ->setDefaultValue(FALSE) ->setSetting('on_label', 'Treat Slots as Parties') ->setDisplayOptions('form', [ @@ -296,8 +296,8 @@ class BookableCalendar extends RevisionableContentEntityBase implements Bookable ->setDisplayConfigurable('view', FALSE); $fields['booking_future_time'] = BaseFieldDefinition::create('string') - ->setLabel(t('Booking Future Time')) - ->setDescription(t('How far in the future from now are people allowed to register, + ->setLabel($this->t('Booking Future Time')) + ->setDescription($this->t('How far in the future from now are people allowed to register, this would stop people from registering for events over a month away. An offset from the current time such as "+ 1 day" "+ 1 month" or "+ 1 year" using php strtotime.')) @@ -310,8 +310,8 @@ class BookableCalendar extends RevisionableContentEntityBase implements Bookable ->setDisplayConfigurable('view', FALSE); $fields['booking_lead_time'] = BaseFieldDefinition::create('string') - ->setLabel(t('Booking Lead Time')) - ->setDescription(t('How close to now are people allowed to register, + ->setLabel($this->t('Booking Lead Time')) + ->setDescription($this->t('How close to now are people allowed to register, this would stop people from registering for same day events. An offset from the current time such as "now" "+ 15 minutes" or "+ 1 day" using php strtotime.')) @@ -326,8 +326,8 @@ class BookableCalendar extends RevisionableContentEntityBase implements Bookable ->setDisplayConfigurable('view', FALSE); $fields['calendar_openings'] = BaseFieldDefinition::create('entity_reference') - ->setLabel(t('Calendar Openings')) - ->setDescription(t('The Openings for this Calendar.')) + ->setLabel($this->t('Calendar Openings')) + ->setDescription($this->t('The Openings for this Calendar.')) ->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED) ->setSettings([ 'target_type' => 'bookable_calendar_opening' @@ -338,8 +338,8 @@ class BookableCalendar extends RevisionableContentEntityBase implements Bookable $fields['active'] = BaseFieldDefinition::create('boolean') ->setRevisionable(TRUE) - ->setLabel(t('Active')) - ->setDescription(t('Allows for calendars to be visible but no longer accepting Bookings whether temporary or permanently.')) + ->setLabel($this->t('Active')) + ->setDescription($this->t('Allows for calendars to be visible but no longer accepting Bookings whether temporary or permanently.')) ->setDefaultValue(TRUE) ->setSetting('on_label', 'Active') ->setDisplayOptions('form', [ @@ -354,8 +354,8 @@ class BookableCalendar extends RevisionableContentEntityBase implements Bookable $fields['status'] = BaseFieldDefinition::create('boolean') ->setRevisionable(TRUE) - ->setLabel(t('Status')) - ->setDescription(t('A boolean indicating whether the bookable calendar is enabled. + ->setLabel($this->t('Status')) + ->setDescription($this->t('A boolean indicating whether the bookable calendar is enabled. It is different than active as this will hide it from end users instead of just disabling Bookings')) ->setDefaultValue(TRUE) ->setSetting('on_label', 'Enabled') only in patch2: unchanged: --- a/src/Entity/BookableCalendarOpening.php +++ b/src/Entity/BookableCalendarOpening.php @@ -101,8 +101,8 @@ class BookableCalendarOpening extends RevisionableContentEntityBase implements B $fields['title'] = BaseFieldDefinition::create('string') ->setRevisionable(TRUE) ->setTranslatable(TRUE) - ->setLabel(t('Title')) - ->setDescription(t('The title of the bookable calendar opening entity.')) + ->setLabel($this->t('Title')) + ->setDescription($this->t('The title of the bookable calendar opening entity.')) ->setRequired(TRUE) ->setSetting('max_length', 255) ->setDisplayOptions('form', [ @@ -119,8 +119,8 @@ class BookableCalendarOpening extends RevisionableContentEntityBase implements B $fields['status'] = BaseFieldDefinition::create('boolean') ->setRevisionable(TRUE) - ->setLabel(t('Status')) - ->setDescription(t('A boolean indicating whether the bookable calendar opening is enabled.')) + ->setLabel($this->t('Status')) + ->setDescription($this->t('A boolean indicating whether the bookable calendar opening is enabled.')) ->setDefaultValue(TRUE) ->setSetting('on_label', 'Enabled') ->setDisplayOptions('form', [ @@ -142,9 +142,9 @@ class BookableCalendarOpening extends RevisionableContentEntityBase implements B ->setDisplayConfigurable('view', TRUE); $fields['bookable_calendar'] = BaseFieldDefinition::create('entity_reference') - ->setLabel(t('Bookable Calendar')) + ->setLabel($this->t('Bookable Calendar')) ->setRequired(TRUE) - ->setDescription(t('The calendar this Opening Belongs to')) + ->setDescription($this->t('The calendar this Opening Belongs to')) ->setCardinality(1) ->setSettings([ 'target_type' => 'bookable_calendar' @@ -170,8 +170,8 @@ class BookableCalendarOpening extends RevisionableContentEntityBase implements B ->setDisplayConfigurable('view', TRUE); $fields['booking_instance'] = BaseFieldDefinition::create('entity_reference') - ->setLabel(t('Booking Instance')) - ->setDescription(t('The Opening Instances for this Opening.')) + ->setLabel($this->t('Booking Instance')) + ->setDescription($this->t('The Opening Instances for this Opening.')) ->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED) ->setSettings([ 'target_type' => 'bookable_calendar_opening_inst' @@ -188,8 +188,8 @@ class BookableCalendarOpening extends RevisionableContentEntityBase implements B ->setDisplayConfigurable('view', TRUE); $fields['date'] = BaseFieldDefinition::create('smartdate') - ->setLabel(t('Date')) - ->setDescription(t('The dates for this opening.')) + ->setLabel($this->t('Date')) + ->setDescription($this->t('The dates for this opening.')) ->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED) ->setRequired(TRUE) ->setDefaultValue([ only in patch2: unchanged: --- a/src/Entity/BookableCalendarOpeningInstance.php +++ b/src/Entity/BookableCalendarOpeningInstance.php @@ -62,8 +62,8 @@ class BookableCalendarOpeningInstance extends ContentEntityBase implements Booka $fields = parent::baseFieldDefinitions($entity_type); $fields['booking'] = BaseFieldDefinition::create('entity_reference') - ->setLabel(t('Booking')) - ->setDescription(t('Each booking that references this instance.')) + ->setLabel($this->t('Booking')) + ->setDescription($this->t('Each booking that references this instance.')) ->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED) ->setSettings([ 'target_type' => 'booking' @@ -89,8 +89,8 @@ class BookableCalendarOpeningInstance extends ContentEntityBase implements Booka ->setDisplayConfigurable('view', TRUE); $fields['booking_opening'] = BaseFieldDefinition::create('entity_reference') - ->setLabel(t('Booking Opening')) - ->setDescription(t('The Opening this Instance points to.')) + ->setLabel($this->t('Booking Opening')) + ->setDescription($this->t('The Opening this Instance points to.')) ->setCardinality(1) ->setRequired(TRUE) ->setSettings([ @@ -117,8 +117,8 @@ class BookableCalendarOpeningInstance extends ContentEntityBase implements Booka ->setDisplayConfigurable('view', TRUE); $fields['date'] = BaseFieldDefinition::create('smartdate') - ->setLabel(t('Date')) - ->setDescription(t('The dates for this opening instance.')) + ->setLabel($this->t('Date')) + ->setDescription($this->t('The dates for this opening instance.')) ->setCardinality(1) ->setRequired(TRUE) ->setDefaultValue([ @@ -139,24 +139,24 @@ class BookableCalendarOpeningInstance extends ContentEntityBase implements Booka ->setDisplayConfigurable('view', TRUE); $fields['available_slots'] = BaseFieldDefinition::create('integer') - ->setLabel(t('Available slots')) - ->setDescription(t('The available slots for this opening instance.')) + ->setLabel($this->t('Available slots')) + ->setDescription($this->t('The available slots for this opening instance.')) ->setCardinality(1) ->setComputed(TRUE) ->setClass('\Drupal\bookable_calendar\AvailableSlotsItemList') ->setDisplayConfigurable('view', TRUE); $fields['max_slots'] = BaseFieldDefinition::create('integer') - ->setLabel(t('Maximum slots')) - ->setDescription(t('The maximum slots for this opening instance.')) + ->setLabel($this->t('Maximum slots')) + ->setDescription($this->t('The maximum slots for this opening instance.')) ->setCardinality(1) ->setComputed(TRUE) ->setClass('\Drupal\bookable_calendar\MaxSlotsItemList') ->setDisplayConfigurable('view', TRUE); $fields['slots'] = BaseFieldDefinition::create('integer') - ->setLabel(t('Slots')) - ->setDescription(t('The number of available slots for this instance. If empty (NB not zero), will use calendar\'s defaults.')) + ->setLabel($this->t('Slots')) + ->setDescription($this->t('The number of available slots for this instance. If empty (NB not zero), will use calendar\'s defaults.')) ->setCardinality(1) ->setDisplayOptions('form', [ 'type' => 'integer', only in patch2: unchanged: --- a/src/Entity/Booking.php +++ b/src/Entity/Booking.php @@ -62,8 +62,8 @@ class Booking extends ContentEntityBase implements BookingInterface { $fields = parent::baseFieldDefinitions($entity_type); $fields['created'] = BaseFieldDefinition::create('created') - ->setLabel(t('Authored on')) - ->setDescription(t('The time that the booking was created.')) + ->setLabel($this->t('Authored on')) + ->setDescription($this->t('The time that the booking was created.')) ->setDisplayOptions('view', [ 'label' => 'above', 'type' => 'timestamp', @@ -77,8 +77,8 @@ class Booking extends ContentEntityBase implements BookingInterface { ->setDisplayConfigurable('view', TRUE); $fields['booking_instance'] = BaseFieldDefinition::create('entity_reference') - ->setLabel(t('Booking Instance')) - ->setDescription(t('The Opening Instance this Booking is for.')) + ->setLabel($this->t('Booking Instance')) + ->setDescription($this->t('The Opening Instance this Booking is for.')) ->setRequired(TRUE) ->setSettings([ 'target_type' => 'bookable_calendar_opening_inst' @@ -104,8 +104,8 @@ class Booking extends ContentEntityBase implements BookingInterface { ->setDisplayConfigurable('view', TRUE); $fields['booking_calendar'] = BaseFieldDefinition::create('entity_reference') - ->setLabel(t('Booking Calendar')) - ->setDescription(t('The parent Calendar this Booking is for.')) + ->setLabel($this->t('Booking Calendar')) + ->setDescription($this->t('The parent Calendar this Booking is for.')) ->setRequired(TRUE) ->setSettings([ 'target_type' => 'bookable_calendar' @@ -131,8 +131,8 @@ class Booking extends ContentEntityBase implements BookingInterface { ->setDisplayConfigurable('view', TRUE); $fields['contact'] = BaseFieldDefinition::create('entity_reference') - ->setLabel(t('Contact')) - ->setDescription(t('The Booking Contact this Booking belongs to.')) + ->setLabel($this->t('Contact')) + ->setDescription($this->t('The Booking Contact this Booking belongs to.')) ->setRequired(TRUE) ->setSettings([ 'target_type' => 'booking_contact' @@ -158,8 +158,8 @@ class Booking extends ContentEntityBase implements BookingInterface { ->setDisplayConfigurable('view', TRUE); $fields['booking_date'] = BaseFieldDefinition::create('smartdate') - ->setLabel(t('Booking Date')) - ->setDescription(t('The date this booking is for.')) + ->setLabel($this->t('Booking Date')) + ->setDescription($this->t('The date this booking is for.')) ->setRequired(TRUE) ->setDefaultValue([ 'default_date_type' => 'next_hour', only in patch2: unchanged: --- a/src/Entity/BookingContact.php +++ b/src/Entity/BookingContact.php @@ -58,8 +58,8 @@ class BookingContact extends ContentEntityBase implements BookingContactInterfac $fields = parent::baseFieldDefinitions($entity_type); $fields['email'] = BaseFieldDefinition::create('email') - ->setLabel(t('Email')) - ->setDescription(t('The email for this booking')) + ->setLabel($this->t('Email')) + ->setDescription($this->t('The email for this booking')) ->setRequired(TRUE) ->setDisplayOptions('form', [ 'type' => 'email_default', @@ -80,8 +80,8 @@ class BookingContact extends ContentEntityBase implements BookingContactInterfac ->setDisplayConfigurable('view', TRUE); $fields['party_size'] = BaseFieldDefinition::create('integer') - ->setLabel(t('Party Size')) - ->setDescription(t('The amount of people this booking is for')) + ->setLabel($this->t('Party Size')) + ->setDescription($this->t('The amount of people this booking is for')) ->setRequired(TRUE) ->setDefaultValue(1) ->addConstraint('CalendarOpeningVacancy') @@ -105,8 +105,8 @@ class BookingContact extends ContentEntityBase implements BookingContactInterfac ->setDisplayConfigurable('view', TRUE); $fields['booking_instance'] = BaseFieldDefinition::create('entity_reference') - ->setLabel(t('Booking Instance')) - ->setDescription(t('The Opening Instance this Booking is for.')) + ->setLabel($this->t('Booking Instance')) + ->setDescription($this->t('The Opening Instance this Booking is for.')) ->setRequired(TRUE) ->addConstraint('CalendarOpeningIsActive') ->addConstraint('CalendarOpeningNotInPast') @@ -136,8 +136,8 @@ class BookingContact extends ContentEntityBase implements BookingContactInterfac ->setDisplayConfigurable('view', TRUE); $fields['booking'] = BaseFieldDefinition::create('entity_reference') - ->setLabel(t('Booking')) - ->setDescription(t('Each booking that this contact owns.')) + ->setLabel($this->t('Booking')) + ->setDescription($this->t('Each booking that this contact owns.')) ->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED) ->setSettings([ 'target_type' => 'booking' @@ -154,8 +154,8 @@ class BookingContact extends ContentEntityBase implements BookingContactInterfac ->setDisplayConfigurable('view', TRUE); $fields['checked_in'] = BaseFieldDefinition::create('boolean') - ->setLabel(t('Checked In')) - ->setDescription(t('Whether or not this user has showed up to their booked event')) + ->setLabel($this->t('Checked In')) + ->setDescription($this->t('Whether or not this user has showed up to their booked event')) ->setDefaultValue(FALSE) ->setSetting('on_label', 'User has checked in') ->setDisplayConfigurable('form', FALSE);