You are here

function context_export_ui::list_build_row in Context 6.3

Same name and namespace in other branches
  1. 6 context_ui/export_ui/context_export_ui.class.php \context_export_ui::list_build_row()
  2. 7.3 context_ui/export_ui/context_export_ui.class.php \context_export_ui::list_build_row()

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

context_ui/export_ui/context_export_ui.class.php, line 26

Class

context_export_ui
CTools export UI extending class. Slightly customized for Context.

Code

function list_build_row($item, &$form_state, $operations) {
  $name = $item->name;

  // Add a row for tags.
  $tag = !empty($item->tag) ? $item->tag : t('< Untagged >');
  if (!isset($this->rows[$tag])) {
    $this->rows[$tag]['data'] = array();
    $this->rows[$tag]['data'][] = array(
      'data' => check_plain($tag),
      'colspan' => 3,
      'class' => 'tag',
    );
    $this->sorts["{$tag}"] = $tag;
  }

  // Build row for each context item.
  $this->rows["{$tag}:{$name}"]['data'] = array();
  $this->rows["{$tag}:{$name}"]['class'] = !empty($item->disabled) ? 'ctools-export-ui-disabled' : 'ctools-export-ui-enabled';
  $this->rows["{$tag}:{$name}"]['data'][] = array(
    'data' => check_plain($name) . "<div class='description'>" . check_plain($item->description) . "</div>",
    'class' => 'ctools-export-ui-name',
  );
  $this->rows["{$tag}:{$name}"]['data'][] = array(
    'data' => check_plain($item->type),
    'class' => 'ctools-export-ui-storage',
  );
  $this->rows["{$tag}:{$name}"]['data'][] = array(
    'data' => theme('links', $operations, array(
      'class' => 'links inline',
    )),
    'class' => 'ctools-export-ui-operations',
  );

  // Sort by tag, name.
  $this->sorts["{$tag}:{$name}"] = $tag . $name;
}