You are here

function views_ui::list_build_row in Views (for Drupal 7) 7.3

Build a row based on the item.

By default all of the rows are placed into a table by the render method, so this is building up a row suitable for theme('table'). This doesn't have to be true if you override both.

Overrides ctools_export_ui::list_build_row

File

plugins/export_ui/views_ui.class.php, line 214
Contains the CTools Export UI integration code.

Class

views_ui
CTools Export UI class handler for Views UI.

Code

function list_build_row($view, &$form_state, $operations) {
  if (!empty($view->human_name)) {
    $title = $view->human_name;
  }
  else {
    $title = $view
      ->get_title();
    if (empty($title)) {
      $title = $view->name;
    }
  }
  $paths = _views_ui_get_paths($view);
  $paths = implode(", ", $paths);
  $base = !empty($this->bases[$view->base_table]) ? $this->bases[$view->base_table] : t('Broken');
  $info = theme('views_ui_view_info', array(
    'view' => $view,
    'base' => $base,
  ));

  // Reorder the operations so that enable is the default action for a
  // templatic views.
  if (!empty($operations['enable'])) {
    $operations = array(
      'enable' => $operations['enable'],
    ) + $operations;
  }

  // Set up sorting.
  switch ($form_state['values']['order']) {
    case 'disabled':
      $this->sorts[$view->name] = strtolower(empty($view->disabled) . $title);
      break;
    case 'name':
      $this->sorts[$view->name] = strtolower($title);
      break;
    case 'path':
      $this->sorts[$view->name] = strtolower($paths);
      break;
    case 'tag':
      $this->sorts[$view->name] = strtolower($view->tag);
      break;
    case 'storage':
      $this->sorts[$view->name] = strtolower($view->type . $title);
      break;
  }
  $theme_args = array(
    'links' => $operations,
    'attributes' => array(
      'class' => array(
        'links',
        'inline',
      ),
    ),
  );
  $ops = theme('links__ctools_dropbutton', $theme_args);
  $this->rows[$view->name] = array(
    'data' => array(
      array(
        'data' => $info,
        'class' => array(
          'views-ui-name',
        ),
      ),
      array(
        'data' => check_plain($view->description),
        'class' => array(
          'views-ui-description',
        ),
      ),
      array(
        'data' => check_plain($view->tag),
        'class' => array(
          'views-ui-tag',
        ),
      ),
      array(
        'data' => $paths,
        'class' => array(
          'views-ui-path',
        ),
      ),
      array(
        'data' => $ops,
        'class' => array(
          'views-ui-operations',
        ),
      ),
    ),
    'title' => t('Machine name: ') . check_plain($view->name),
    'class' => array(
      !empty($view->disabled) ? 'ctools-export-ui-disabled' : 'ctools-export-ui-enabled',
    ),
  );
}