| 46 |
} |
} |
| 47 |
|
|
| 48 |
function theme_office_hours($element) { |
function theme_office_hours($element) { |
| 49 |
|
//dpm($element); |
| 50 |
return $element['#children']; |
return $element['#children']; |
| 51 |
} |
} |
| 52 |
|
|
| 58 |
} |
} |
| 59 |
|
|
| 60 |
/** |
/** |
| 61 |
* copied from content module's theme_content_multiple values- we're taking out the draggable feature. |
* copied from content module's theme_content_multiple_values- we're taking out the draggable feature. |
| 62 |
* Theme an individual form element. |
* |
| 63 |
|
* Theme the hour table form |
| 64 |
* |
* |
| 65 |
*/ |
*/ |
| 66 |
function theme_office_hours_multiple_values($element) { |
function theme_office_hours_multiple_values($element) { |
| 76 |
$header = array( |
$header = array( |
| 77 |
array( |
array( |
| 78 |
'data' => t('!title: !required', array('!title' => $element['#title'], '!required' => $required)), |
'data' => t('!title: !required', array('!title' => $element['#title'], '!required' => $required)), |
| 79 |
'colspan' => 2 |
'colspan' => 1 |
| 80 |
), |
), |
|
// t('Order'), |
|
| 81 |
); |
); |
| 82 |
$rows = array(); |
$rows = array(); |
| 83 |
|
|
| 89 |
$items[] = &$element[$key]; |
$items[] = &$element[$key]; |
| 90 |
} |
} |
| 91 |
} |
} |
| 92 |
// usort($items, '_content_sort_items_value_helper'); |
|
| 93 |
$items = _office_hours_arrange_day($items); |
// dpm($items); |
| 94 |
|
$items = _office_hours_arrange_day($items); //this calls the function that arranges the first day of the week. |
| 95 |
|
|
| 96 |
// Add the items as table rows. |
// Add the items as table rows. |
| 97 |
foreach ($items as $key => $item) { |
foreach ($items as $key => $item) { |
|
$item['_weight']['#attributes']['class'] = $order_class; |
|
| 98 |
$delta_element = drupal_render($item['_weight']); |
$delta_element = drupal_render($item['_weight']); |
| 99 |
$cells = array( |
if (!($key % 2)) { //this is an even row, start a new row array_keys |
| 100 |
array('data' => '', 'class' => 'content-multiple-drag'), |
$cells = array ( |
| 101 |
drupal_render($item), |
drupal_render($item), |
| 102 |
//array('data' => $delta_element, 'class' => 'delta-order'), |
); |
| 103 |
); |
} |
| 104 |
|
else { //this is an odd row |
| 105 |
$rows[] = array( |
$cells[] = drupal_render($item); //we've add the second cell; |
| 106 |
|
$rows[] = array( |
| 107 |
'data' => $cells, |
'data' => $cells, |
| 108 |
//'class' => 'draggable', |
); |
| 109 |
); |
} |
| 110 |
} |
} |
| 111 |
|
|
| 112 |
$output .= theme('table', $header, $rows, array('id' => $table_id, 'class' => 'office_hours_table content-multiple-table')); |
$output .= theme('table', $header, $rows, array('id' => $table_id, 'class' => 'office_hours_table content-multiple-table')); |
| 113 |
$output .= $element['#description'] ? '<div class="description">'. $element['#description'] .'</div>' : ''; |
$output .= $element['#description'] ? '<div class="description">'. $element['#description'] .'</div>' : ''; |
| 114 |
$output .= drupal_render($element[$element['#field_name'] .'_add_more']); |
// $output .= drupal_render($element[$element['#field_name'] .'_add_more']); |
| 115 |
|
|
| 116 |
//drupal_add_tabledrag($table_id, 'order', 'sibling', $order_class); |
//drupal_add_tabledrag($table_id, 'order', 'sibling', $order_class); |
| 117 |
} |
} |