Skip to content
Snippets Groups Projects
Commit 273e17aa authored by Ryan Kavalsky's avatar Ryan Kavalsky Committed by Owen Bush
Browse files

Issue #3183502 by ryankavalsky, owenbush: Allow Registration Messages to be Customized

parent f39081e6
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,12 @@ limit: 10 ...@@ -3,6 +3,12 @@ limit: 10
date_format: 'F jS, Y h:iA' date_format: 'F jS, Y h:iA'
title: '[registrant:email]' title: '[registrant:email]'
email_notifications: true email_notifications: true
successfully_registered: Registrant successfully created.
successfully_registered_waitlist: Successfully registered to the waitlist.
successfully_updated: Registrant successfully updated.
successfully_updated_waitlist: Successfully updated waitlist registrant.
already_registered: User already registered for this event.
registration_closed: Unfortunately, registration is not available at this time.
registration_notification_enabled: true registration_notification_enabled: true
registration_notification_subject: 'You''ve Successfully Registered' registration_notification_subject: 'You''ve Successfully Registered'
registration_notification_body: "Your registration for the [eventinstance:title] [eventinstance:reg_type] was successful.\r\n\r\nModify your registration: [registrant:edit_url]\r\nDelete your registration: [registrant:delete_url]" registration_notification_body: "Your registration for the [eventinstance:title] [eventinstance:reg_type] was successful.\r\n\r\nModify your registration: [registrant:edit_url]\r\nDelete your registration: [registrant:delete_url]"
......
...@@ -175,3 +175,18 @@ function recurring_events_registration_update_8003() { ...@@ -175,3 +175,18 @@ function recurring_events_registration_update_8003() {
} }
} }
} }
/**
* Add the default registration message configurations.
*/
function recurring_events_registration_update_8004() {
// Configure the registrantion messages.
\Drupal::configFactory()->getEditable('recurring_events_registration.registrant.config')
->set('successfully_registered', 'Registrant successfully created.')
->set('successfully_registered_waitlist', 'Successfully registered to the waitlist.')
->set('successfully_updated', 'Registrant successfully updated.')
->set('successfully_updated_waitlist', 'Successfully updated waitlist registrant.')
->set('already_registered', 'ser already registered for this event.')
->set('registration_closed', 'Unfortunately, registration is not available at this time.')
->save(TRUE);
}
\ No newline at end of file
<?php
namespace Drupal\recurring_events_registration\Entity;
use Drupal\views\EntityViewsData;
/**
* Provides Views data for Registrant entities.
*/
class RegistrantViewsData extends EntityViewsData {
/**
* {@inheritdoc}
*/
public function getViewsData() {
$data = parent::getViewsData();
// Additional information for Views integration, such as table joins, can be
// put here.
return $data;
}
}
...@@ -421,16 +421,16 @@ class RegistrantForm extends ContentEntityForm { ...@@ -421,16 +421,16 @@ class RegistrantForm extends ContentEntityForm {
switch ($status) { switch ($status) {
case SAVED_NEW: case SAVED_NEW:
$message = $this->t('Registrant successfully created.'); $message = $this->t($this->config('recurring_events_registration.registrant.config')->get('successfully_registered'));
if ($add_to_waitlist) { if ($add_to_waitlist) {
$message = $this->t('Successfully registered to the waitlist.'); $message = $this->t($this->config('recurring_events_registration.registrant.config')->get('successfully_registered_waitlist'));
} }
break; break;
default: default:
$message = $this->t('Registrant successfully updated.'); $message = $this->t($this->config('recurring_events_registration.registrant.config')->get('successfully_registered_waitlist'));
if ($add_to_waitlist) { if ($add_to_waitlist) {
$message = $this->t('Successfully updated waitlist registrant.'); $message = $this->t($this->config('recurring_events_registration.registrant.config')->get('successfully_registered_waitlist'));
} }
break; break;
} }
...@@ -452,7 +452,7 @@ class RegistrantForm extends ContentEntityForm { ...@@ -452,7 +452,7 @@ class RegistrantForm extends ContentEntityForm {
$this->cacheTagsInvalidator->invalidateTags($tags); $this->cacheTagsInvalidator->invalidateTags($tags);
} }
else { else {
$this->messenger->addMessage($this->t('Unfortunately, registration is not available at this time.')); $this->messenger->addMessage($this->t($this->config('recurring_events_registration.registrant.config')->get('registration_closed')));
} }
} }
......
...@@ -97,6 +97,12 @@ class RegistrantSettingsForm extends ConfigFormBase { ...@@ -97,6 +97,12 @@ class RegistrantSettingsForm extends ConfigFormBase {
->set('limit', $form_state->getValue('limit')) ->set('limit', $form_state->getValue('limit'))
->set('date_format', $form_state->getValue('date_format')) ->set('date_format', $form_state->getValue('date_format'))
->set('title', $form_state->getValue('title')) ->set('title', $form_state->getValue('title'))
->set('successfully_registered', $form_state->getValue('successfully_registered'))
->set('successfully_registered_waitlist', $form_state->getValue('successfully_registered_waitlist'))
->set('successfully_updated', $form_state->getValue('successfully_updated'))
->set('successfully_updated_waitlist', $form_state->getValue('successfully_updated_waitlist'))
->set('already_registered', $form_state->getValue('already_registered'))
->set('registration_closed', $form_state->getValue('registration_closed'))
->set('email_notifications', $form_state->getValue('email_notifications')); ->set('email_notifications', $form_state->getValue('email_notifications'));
$notification_types = []; $notification_types = [];
...@@ -180,6 +186,56 @@ class RegistrantSettingsForm extends ConfigFormBase { ...@@ -180,6 +186,56 @@ class RegistrantSettingsForm extends ConfigFormBase {
$form['display']['tokens'] = $registrant_tokens; $form['display']['tokens'] = $registrant_tokens;
$form['messages'] = [
'#type' => 'details',
'#title' => $this->t('Registration Messages'),
'#open' => TRUE,
];
$form['messages']['successfully_registered'] = [
'#type' => 'textarea',
'#title' => $this->t('Successful Registration'),
'#description' => $this->t('This message will show in the message area when a user successfully registers for an event.'),
'#default_value' => $config->get('successfully_registered'),
];
$form['messages']['successfully_registered_waitlist'] = [
'#type' => 'textarea',
'#title' => $this->t('Successful Registration (Waitlist)'),
'#description' => $this->t('This message will show in the message area when a user successfully registers for an event\'s waitlist.'),
'#default_value' => $config->get('successfully_registered_waitlist'),
];
$form['messages']['successfully_updated'] = [
'#type' => 'textarea',
'#title' => $this->t('Successful Update'),
'#description' => $this->t('This message will show in the message area when a user successfully updates a registration for an event.'),
'#default_value' => $config->get('successfully_updated'),
];
$form['messages']['successfully_updated_waitlist'] = [
'#type' => 'textarea',
'#title' => $this->t('Successful Update (Waitlist)'),
'#description' => $this->t('This message will show in the message area when a user successfully updates a registration for an event\'s waitlist.'),
'#default_value' => $config->get('successfully_updated_waitlist'),
];
$form['messages']['already_registered'] = [
'#type' => 'textarea',
'#title' => $this->t('Duplicate Registration'),
'#description' => $this->t('This message will show in the message area when a user tries to register a second time for the same event.'),
'#default_value' => $config->get('already_registered'),
];
$form['messages']['registration_closed'] = [
'#type' => 'textarea',
'#title' => $this->t('Registration Window Closed'),
'#description' => $this->t('This message will show in the message area when a user tries to register for an event for which registrations are closed.'),
'#default_value' => $config->get('registration_closed'),
];
$form['messages']['tokens'] = $registrant_tokens;
$form['notifications'] = [ $form['notifications'] = [
'#type' => 'details', '#type' => 'details',
'#title' => $this->t('Email Notifications'), '#title' => $this->t('Email Notifications'),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment