You are here

protected function AvailabilityCalendarStylesFormBuilder::fieldsetStates in Availability Calendars 7.4

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

Helper method to return the fieldset for the states styles.

Return value

array An array with a number of form elements in a fieldset

1 call to AvailabilityCalendarStylesFormBuilder::fieldsetStates()
AvailabilityCalendarStylesFormBuilder::exec in ./availability_calendar.styles.inc

File

./availability_calendar.styles.inc, line 228

Class

AvailabilityCalendarStylesFormBuilder

Code

protected function fieldsetStates() {
  $this->currentFieldset = 'states';
  $this->form[$this->currentFieldset] = array(
    '#type' => 'fieldset',
    '#title' => t('States'),
    '#description' => t('Styles that define how the states will be displayed.'),
  );
  $this
    ->selectField('split-day', array(
    '/',
    '\\',
    '|',
    '―',
  ));

  // Translate the title 'Split day' but only after creating the form element
  // (otherwise the default value can't be retrieved from the styles array).
  $this->form[$this->currentFieldset]['split-day']['#title'] = t('How to render a split day');
  $states = availability_calendar_get_states();
  foreach ($states as $sid => $state) {
    $this
      ->colorField(array(
      $state['css_class'] => $state['label'],
    ));
  }
}