protected function AvailabilityCalendarsStylesFormBuilder::colorField in Availability Calendars 7.2
Same name and namespace in other branches
- 6.2 availability_calendars.styles.inc \AvailabilityCalendarsStylesFormBuilder::colorField()
Helper method to add a color field to a given fieldset. By extracting this, we get standardized settings and handling for color fields. E.g: for now only color codes are allowed, but this function could add support for other notations (http://www.w3.org/TR/CSS21/syndata.html#color-units) or a color picker.
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>.
2 calls to AvailabilityCalendarsStylesFormBuilder::colorField()
- 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 281
Class
Code
protected function colorField($cssProperty) {
if (is_array($cssProperty)) {
list($fieldName, $cssProperty) = each($cssProperty);
}
else {
$fieldName = $cssProperty;
}
$this->form[$this->currentFieldset][$fieldName] = array(
'#type' => 'textfield',
'#title' => $cssProperty,
'#default_value' => $this
->getStyle($fieldName),
'#size' => 8,
'#maxlength' => 7,
'#field_prefix' => '#',
);
}