You are here

function _signup_get_date_field_options in Signup 5.2

Same name and namespace in other branches
  1. 6.2 includes/date.inc \_signup_get_date_field_options()
  2. 6 includes/date.inc \_signup_get_date_field_options()
  3. 7 includes/date.inc \_signup_get_date_field_options()

Helper function for the date field select to build its options.

Parameters

$type: Content type whose date fields should be listed.

Return value

Associative array with all date fields of the given content type plus 'None' and an optional 'Not specified' if the user never selected a value.

1 call to _signup_get_date_field_options()
_signup_date_field_element in includes/date.inc
Create the FAPI form element for the signup date field.

File

includes/date.inc, line 282
Shared code required for any site using CCK date fields, regardless of the version of date in use.

Code

function _signup_get_date_field_options($type) {
  $options = array();

  // Add "Not specified" if the user never selected a field.
  if (variable_get('signup_date_field_' . $type, 0) == 0) {
    $options = array(
      0 => t('<Not specified>'),
    );
  }

  // Add any date fields from this node type.
  $options += signup_field_names($type);

  // Always add 'None' as the final choice.
  $options += array(
    'none' => t('<None>'),
  );
  return $options;
}