You are here

function social_event_enroll_method_description in Open Social 10.2.x

Same name and namespace in other branches
  1. 10.3.x modules/social_features/social_event/social_event.module \social_event_enroll_method_description()
  2. 10.0.x modules/social_features/social_event/social_event.module \social_event_enroll_method_description()
  3. 10.1.x modules/social_features/social_event/social_event.module \social_event_enroll_method_description()

Returns a description array for the field_enroll_method options.

Return value

string The render array containing the description.

1 call to social_event_enroll_method_description()
social_event_preprocess_fieldset in modules/social_features/social_event/social_event.module
Implements template_preprocess_form_element().

File

modules/social_features/social_event/social_event.module, line 1127
The Social event module.

Code

function social_event_enroll_method_description($key) {
  $description = '';

  // We need it to be specified otherwise we can't build the markup.
  if (empty($key)) {
    return $description;
  }

  // Add explanatory descriptive text.
  switch ($key) {
    case EventEnrollmentInterface::ENROLL_METHOD_JOIN:
      $description = '<p><strong>' . t('Open to enroll')
        ->render() . '</strong>';
      $description .= ' - ' . t('users can enroll for this event without approval')
        ->render();
      $description .= '</p>';
      break;
    case EventEnrollmentInterface::ENROLL_METHOD_REQUEST:
      $description = '<p><strong>' . t('Request to enroll')
        ->render() . '</strong>';
      $description .= ' - ' . t('users can "request to enroll" for this event which event organisers approve/decline')
        ->render();
      $description .= '</p>';
      break;
    case EventEnrollmentInterface::ENROLL_METHOD_INVITE:
      $description = '<strong>' . t('Invite-only')
        ->render() . '</strong>';
      $description .= ' - ' . t('users can only enroll for this event if they are added/invited by event organisers')
        ->render();
      $description .= '</p>';
      break;
  }

  // Allow modules to provide their own markup for a given key in the
  // event enroll method #options array.
  \Drupal::moduleHandler()
    ->alter('social_event_enroll_method_description', $key, $description);
  return $description;
}