You are here

protected function AvailabilityCalendarStylesFormBuilder::selectField in Availability Calendars 7.3

Same name and namespace in other branches
  1. 7.5 availability_calendar.styles.inc \AvailabilityCalendarStylesFormBuilder::selectField()
  2. 7.4 availability_calendar.styles.inc \AvailabilityCalendarStylesFormBuilder::selectField()

Helper method to add a select field to a given fieldset.

Parameters

string|array $css_property The name of the css color property to add.: If this is not the same as the form field name, pass in an array with 1 element: <field name> => <css property>.

array $options: The options to present. An option <none> will be added in front of this list, to allow to select for not setting and thus not generating this property.

5 calls to AvailabilityCalendarStylesFormBuilder::selectField()
AvailabilityCalendarStylesFormBuilder::fieldsetCaption in ./availability_calendar.styles.inc
Helper method to return the fieldset for the caption styles.
AvailabilityCalendarStylesFormBuilder::fieldsetDays in ./availability_calendar.styles.inc
Helper method to return the fieldset for the day styles.
AvailabilityCalendarStylesFormBuilder::fieldsetHeader in ./availability_calendar.styles.inc
Helper method to return the fieldset for the table header styles.
AvailabilityCalendarStylesFormBuilder::fieldsetStates in ./availability_calendar.styles.inc
Helper method to return the fieldset for the states styles.
AvailabilityCalendarStylesFormBuilder::fieldsetTable in ./availability_calendar.styles.inc
Helper method to return the fieldset for the table styles.

File

./availability_calendar.styles.inc, line 303

Class

AvailabilityCalendarStylesFormBuilder

Code

protected function selectField($cssProperty, $options) {
  if (is_array($cssProperty)) {
    list($fieldName, $cssProperty) = each($cssProperty);
  }
  else {
    $fieldName = $cssProperty;
  }
  array_unshift($options, t('<none>'));
  $options = array_combine($options, $options);
  $this->form[$this->currentFieldset][$fieldName] = array(
    '#type' => 'select',
    '#title' => $cssProperty,
    '#default_value' => $this
      ->getStyle($fieldName),
    '#options' => $options,
  );
}