protected function AvailabilityCalendarStylesFormBuilder::selectField in Availability Calendars 7.4
Same name and namespace in other branches
- 7.5 availability_calendar.styles.inc \AvailabilityCalendarStylesFormBuilder::selectField()
- 7.3 availability_calendar.styles.inc \AvailabilityCalendarStylesFormBuilder::selectField()
Helper method to add a select field to a given fieldset.
Parameters
string|array $cssProperty: 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 316
Class
Code
protected function selectField($cssProperty, $options) {
if (is_array($cssProperty)) {
list($fieldName, $cssProperty) = each($cssProperty);
}
else {
$fieldName = $cssProperty;
}
// We only translate the label, not the key value that will be stored.
array_unshift($options, '<none>');
$options = array_combine($options, $options);
$options['<none>'] = t('<none>');
$this->form[$this->currentFieldset][$fieldName] = array(
'#type' => 'select',
'#title' => $cssProperty,
'#default_value' => $this
->getStyle($fieldName),
'#options' => $options,
);
}