You are here

function theme_office_hours_week in Office Hours 7

Theme function for widget: office_hours complete week.

1 theme call to theme_office_hours_week()
office_hours_field_widget_form in includes/office_hours.widget.inc
Implements hook_field_widget_form().

File

includes/office_hours.theme.inc, line 191
Themes the Office hours formatter and widget.

Code

function theme_office_hours_week($variables) {
  $element = $variables['element'];
  $output = '';
  $table_id = drupal_html_id($element['#field_name'] . '_values');
  $required = !empty($element['#required']) ? theme('form_required_marker', $variables) : '';
  $header = array(
    array(
      'data' => '<label>' . t('!title: !required', array(
        '!title' => $element['#title'],
        '!required' => $required,
      )) . "</label>",
      'class' => array(
        'field-label',
      ),
    ),
  );
  $rows = array();
  foreach (element_children($element) as $key) {
    $rows[] = array(
      drupal_render($element[$key]),
    );
  }
  $output = '<div class="form-item">';
  $output .= theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'attributes' => array(
      'id' => $table_id,
      'class' => array(
        'field-multiple-table',
      ),
    ),
  ));
  $output .= $element['#description'] ? '<div class="description">' . $element['#description'] . '</div>' : '';
  $output .= '</div>';
  return $output;
}