You are here

function rng_event_field_config_definition in RNG - Events and Registrations 8

Same name and namespace in other branches
  1. 8.2 rng.field.defaults.inc \rng_event_field_config_definition()
  2. 3.x rng.field.defaults.inc \rng_event_field_config_definition()
2 calls to rng_event_field_config_definition()
EventTypeFieldMappingForm::buildForm in src/Form/EventTypeFieldMappingForm.php
Form constructor.
rng_add_event_field_config in ./rng.field.defaults.inc

File

./rng.field.defaults.inc, line 90
Creates field config if they do not exist.

Code

function rng_event_field_config_definition($field_name) {
  $definition = array();
  switch ($field_name) {
    case EventManagerInterface::FIELD_REGISTRATION_TYPE:
      $definition = array(
        'label' => 'Registration type',
        'settings' => array(
          'handler' => 'default',
        ),
        'description' => t('Select which registration types are valid for this event.'),
      );
      break;
    case EventManagerInterface::FIELD_REGISTRATION_GROUPS:
      $definition = array(
        'label' => 'Registration groups',
        'settings' => array(
          'handler' => 'default',
        ),
        'description' => t('New registrations will be added to these groups.'),
      );
      break;
    case EventManagerInterface::FIELD_STATUS:
      $definition = array(
        'label' => 'Accept new registrations',
        'settings' => [
          'on_label' => t('Accepting new registrations'),
          'off_label' => t('Not accepting new registrations'),
        ],
      );
      break;
    case EventManagerInterface::FIELD_CAPACITY:
      $definition = array(
        'label' => 'Maximum registrations',
        'description' => t('Maximum amount of registrations for this event.'),
        'settings' => array(
          'min' => 1,
        ),
      );
      break;
    case EventManagerInterface::FIELD_EMAIL_REPLY_TO:
      $definition = array(
        'label' => t('Reply-to e-mail address'),
        'description' => t('E-mail address that appears as reply-to when emails are sent from this event. Leave empty to use site default.'),
      );
      break;
    case EventManagerInterface::FIELD_ALLOW_DUPLICATE_REGISTRANTS:
      $definition = array(
        'label' => 'Allow duplicate registrants',
        'description' => t('Allows a registrant to create more than one registration for this event.'),
        'settings' => [
          'on_label' => t('Allow duplicate registrants for this event'),
          'off_label' => t('Do not allow duplicate registrants for this event'),
        ],
      );
      break;
    case EventManagerInterface::FIELD_REGISTRATION_REGISTRANTS_MINIMUM:
      $definition = array(
        'label' => 'Minimum registrants',
        'description' => t('Minimum number of registrants per registration.'),
        'settings' => [
          'min' => 0,
        ],
        'default_value' => [
          [
            'value' => 1,
          ],
        ],
      );
      break;
    case EventManagerInterface::FIELD_REGISTRATION_REGISTRANTS_MAXIMUM:
      $definition = array(
        'label' => 'Maximum registrants',
        'description' => t('Maximum number of registrants per registration.'),
        'settings' => [
          'min' => -1,
        ],
        'default_value' => [
          [
            'value' => -1,
          ],
        ],
      );
      break;
  }
  return $definition;
}