You are here

protected function AvailabilityCalendarsStylesFormBuilder::selectField in Availability Calendars 7.2

Same name and namespace in other branches
  1. 6.2 availability_calendars.styles.inc \AvailabilityCalendarsStylesFormBuilder::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 AvailabilityCalendarsStylesFormBuilder::selectField()
AvailabilityCalendarsStylesFormBuilder::fieldsetCaption in ./availability_calendars.styles.inc
Helper method to return the fieldset for the caption styles.
AvailabilityCalendarsStylesFormBuilder::fieldsetDays in ./availability_calendars.styles.inc
Helper method to return the fieldset for the day styles.
AvailabilityCalendarsStylesFormBuilder::fieldsetHeader in ./availability_calendars.styles.inc
Helper method to return the fieldset for the table header styles.
AvailabilityCalendarsStylesFormBuilder::fieldsetStates in ./availability_calendars.styles.inc
Helper method to return the fieldset for the states styles.
AvailabilityCalendarsStylesFormBuilder::fieldsetTable in ./availability_calendars.styles.inc
Helper method to return the fieldset for the table styles.

File

./availability_calendars.styles.inc, line 307

Class

AvailabilityCalendarsStylesFormBuilder

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,
  );
}