diff --git a/modules/recurring_events_registration/recurring_events_registration.module b/modules/recurring_events_registration/recurring_events_registration.module index 1927c939aaeed8f444f951eb7b357d2c0af6ff90..9a3da95c216414eccf36c68e7264d47045c146f3 100644 --- a/modules/recurring_events_registration/recurring_events_registration.module +++ b/modules/recurring_events_registration/recurring_events_registration.module @@ -6,6 +6,8 @@ */ use Drupal\Core\Routing\RouteMatchInterface; +use Drupal\Core\Entity\EntityTypeInterface; +use Drupal\Core\Field\BaseFieldDefinition; /** * Implements hook_help(). @@ -22,3 +24,73 @@ function recurring_events_registration_help($route_name, RouteMatchInterface $ro default: } } + +/** + * Implements hook_entity_base_field_info_alter(). + */ +function recurring_events_registration_entity_base_field_info_alter(&$fields, EntityTypeInterface $entity_type) { + if ($entity_type->id() === 'eventseries') { + // TODO Registration fields to all be one custom field. + $fields['registration'] = BaseFieldDefinition::create('boolean') + ->setLabel(t('Enable Registration')) + ->setDescription(t('Select whether to enable registration for this series.')) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE) + ->setRevisionable(TRUE) + ->setCardinality(1) + ->setDisplayOptions('form', [ + 'type' => 'boolean_checkbox', + 'settings' => [ + 'display_label' => TRUE, + ], + 'weight' => 100, + ]) + ->setDisplayOptions('view', [ + 'type' => 'hidden', + ]); + + $fields['registration_type'] = BaseFieldDefinition::create('list_string') + ->setLabel(t('Registration Type')) + ->setDescription(t('Select which type of registration applies to this event.')) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE) + ->setRevisionable(TRUE) + ->setCardinality(1) + ->setSetting('allowed_values', [ + 'instance' => t('Individual Event Registration'), + 'series' => t('Entire Series Registration'), + ]) + ->setDisplayOptions('form', [ + 'type' => 'options_buttons', + 'settings' => [ + 'allowed_values' => [ + 'instance' => t('Individual Event Registration'), + 'series' => t('Entire Series Registration'), + ], + ], + 'weight' => 101, + ]); + + $fields['registration_dates'] = BaseFieldDefinition::create('list_string') + ->setLabel(t('Registration Dates')) + ->setDescription(t('Select whether to enable open or scheduled registration')) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE) + ->setRevisionable(TRUE) + ->setCardinality(1) + ->setSetting('allowed_values', [ + 'open' => t('Open Registration'), + 'scheduled' => t('Scheduled Registration'), + ]) + ->setDisplayOptions('form', [ + 'type' => 'options_buttons', + 'settings' => [ + 'allowed_values' => [ + 'open' => t('Open Registration'), + 'scheduled' => t('Scheduled Registration'), + ], + ], + 'weight' => 102, + ]); + } +} diff --git a/src/Entity/EventSeries.php b/src/Entity/EventSeries.php index b7e722e27fd68f3062976fd4d27cc049ee8dd445..bffe20a85a00664dbb25ac3afa507dfb8f863c5f 100644 --- a/src/Entity/EventSeries.php +++ b/src/Entity/EventSeries.php @@ -381,7 +381,7 @@ class EventSeries extends EditorialContentEntityBase implements EventInterface { ->setDisplayOptions('view', [ 'label' => 'above', 'weight' => 10, - ]);; + ]); $fields['weekly_recurring_date'] = BaseFieldDefinition::create('weekly_recurring_date') ->setLabel(t('Weekly Recurring Date')) diff --git a/src/Form/EventInstanceSettingsForm.php b/src/Form/EventInstanceSettingsForm.php index 4ddbb89a1c67cee071bd4a7bac2d06a4dd78c304..85130ea61dd7d7a4f4bd23ff4874203492a8b5d4 100644 --- a/src/Form/EventInstanceSettingsForm.php +++ b/src/Form/EventInstanceSettingsForm.php @@ -2,7 +2,7 @@ namespace Drupal\recurring_events\Form; -use Drupal\Core\Form\ConfigFormBase;; +use Drupal\Core\Form\ConfigFormBase; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Url; use Drupal\Core\Link; diff --git a/src/Form/EventSeriesSettingsForm.php b/src/Form/EventSeriesSettingsForm.php index 1379d80b38aa14414412470dd2ec1d1da0fbc9db..b81b02e6b425f23133944871c1c2390f25611c4b 100644 --- a/src/Form/EventSeriesSettingsForm.php +++ b/src/Form/EventSeriesSettingsForm.php @@ -2,7 +2,7 @@ namespace Drupal\recurring_events\Form; -use Drupal\Core\Form\ConfigFormBase;; +use Drupal\Core\Form\ConfigFormBase; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Url; use Drupal\Core\Link;