You are here

function registration_broadcast_preview in Entity Registration 8.2

Same name and namespace in other branches
  1. 8 includes/registration.forms.inc \registration_broadcast_preview()
  2. 7.2 includes/registration.forms.inc \registration_broadcast_preview()
  3. 7 includes/registration.forms.inc \registration_broadcast_preview()
1 string reference to 'registration_broadcast_preview'
registration_registrations_broadcast_form in includes/registration.forms.inc
Return a form for sending a broadcast email to participants.

File

includes/registration.forms.inc, line 490
Form definitions and callbacks for Registration.

Code

function registration_broadcast_preview($form, &$form_state) {
  $entity_type = $form_state['entity']['entity_type'];
  $entity_id = $form_state['entity']['entity_id'];
  $message_template = $form_state['values']['message'];
  $entity = entity_load_single($entity_type, $entity_id);
  if (\Drupal::moduleHandler()
    ->moduleExists('token')) {
    $message = \Drupal::token()
      ->replace($message_template, array(
      $entity_type => $entity,
    ));
  }
  $form_state['registration_broadcast_preview'] = $message;
  $form_state['rebuild'] = TRUE;
}