You are here

function _webform_grid_header in Webform 7.4

Generate a table header suitable for form or html display.

Parameters

array $element: The element array.

bool $right_titles: If TRUE, display a right-side title column.

Return value

array An array of headers.

2 calls to _webform_grid_header()
theme_webform_display_grid in components/grid.inc
Format the text output for this component.
theme_webform_grid in components/grid.inc
Theme function to render a grid component.

File

components/grid.inc, line 765
Webform module grid component.

Code

function _webform_grid_header(array $element, $right_titles) {
  $titles = explode('|', $element['#title'], 2);
  $title_left = $titles[0];
  $header = array(
    array(
      'data' => _webform_grid_header_title($element, $title_left),
      'class' => array(
        'webform-grid-question',
      ),
      'scope' => 'col',
    ),
  );
  foreach ($element['#grid_options'] as $option) {
    $header[] = array(
      'data' => webform_filter_xss($option),
      'class' => array(
        'checkbox',
        'webform-grid-option',
      ),
      'scope' => 'col',
    );
  }
  if ($right_titles) {
    $title_right = isset($titles[1]) ? $titles[1] : $title_left;
    $header[] = array(
      'data' => _webform_grid_header_title($element, $title_right),
      'class' => array(
        'webform-grid-question',
      ),
      'scope' => 'col',
    );
  }
  return $header;
}