You are here

function registration_field_widget_form in Entity Registration 7

Same name and namespace in other branches
  1. 8.2 includes/registration.field.inc \registration_field_widget_form()
  2. 8 includes/registration.field.inc \registration_field_widget_form()
  3. 7.2 includes/registration.field.inc \registration_field_widget_form()

Implements hook_field_widget_form().

File

includes/registration.field.inc, line 134
Field hooks.

Code

function registration_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
  $options = array(
    '' => t('-- Disable Registrations --'),
  );
  foreach (registration_get_types() as $type) {
    $options[$type->name] = $type->label;
  }
  $element += array(
    '#type' => 'select',
    '#options' => $options,
    '#default_value' => isset($items[$delta]) ? $items[$delta] : array(),
  );

  // force some help text into the field, appending anything the user added.
  $element['#description'] .= ' ' . t('Select what type of registrations should be
    enabled for this @type. Depending on the display settings, it will appear
    as either string, registration link, or form.', array(
    '@type' => $instance['bundle'],
  ));
  return array(
    'registration_type' => $element,
  );
}