You are here

function views_ui_render_section in Views (for Drupal 7) 5

Render one of the dynamic sections on our form.

1 call to views_ui_render_section()
theme_views_edit_view in ./views_ui.module
Display the form built by _views_view_form()

File

./views_ui.module, line 1687

Code

function views_ui_render_section(&$form, $items, $header, $section, &$collapsed) {

  // always do the buttons
  $items = array_merge($items, array(
    'delete',
    'top',
    'up',
    'down',
    'bottom',
  ));
  $num_items = count($items);
  $order = $form['order']['#value'] != '' ? explode(',', $form['order']['#value']) : array();
  $count = count($order) - 1;
  foreach ($order as $key => $i) {
    $row = array();
    foreach ($items as $item) {

      // Hide the delete button on exposed filters.
      if ($item == 'delete' && $section == 'filters' && empty($form[$i]['expose'])) {
        $form[$i][$item]['#printed'] = true;
      }
      if ($key == 0 && ($item == 'up' || $item == 'top') || $key == $count && ($item == 'down' || $item == 'bottom')) {
        $form[$i][$item]['#printed'] = true;
        $row[] = ' ';

        // array('data' => ' ', 'width' => 16);
      }
      else {
        $row[] = drupal_render($form[$i][$item], false);
      }
    }
    $rows[] = $row;
    if (isset($form[$i]['help'])) {
      $rows[] = array(
        array(
          'data' => drupal_render($form[$i]['help']),
          'colspan' => $num_items,
        ),
      );
    }
  }
  if (!$rows) {
    $rows[] = array(
      array(
        'data' => t('This view currently has no %s defined.', array(
          '%s' => $section,
        )),
        'colspan' => $num_items,
      ),
    );
    $collapsed = true;
  }
  $header[] = array(
    'data' => t('Ops'),
    'colspan' => 5,
  );
  return theme('table', $header, $rows) . "<br />";
}