You are here

function context_export_ui::list_build_row in Context 7.3

Same name and namespace in other branches
  1. 6.3 context_ui/export_ui/context_export_ui.class.php \context_export_ui::list_build_row()
  2. 6 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 34

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' => array(
        '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) ? array(
    'ctools-export-ui-disabled',
  ) : array(
    'ctools-export-ui-enabled',
  );
  $this->rows["{$tag}:{$name}"]['data'][] = array(
    'data' => check_plain($name) . "<div class='description'>" . check_plain($item->description) . "</div>",
    'class' => array(
      'ctools-export-ui-name',
    ),
  );
  $this->rows["{$tag}:{$name}"]['data'][] = array(
    'data' => check_plain($item->type),
    'class' => array(
      'ctools-export-ui-storage',
    ),
  );
  $this->rows["{$tag}:{$name}"]['data'][] = array(
    'data' => theme('links', array(
      'links' => $operations,
      'attributes' => array(
        'class' => array(
          'links inline',
        ),
      ),
    )),
    'class' => array(
      'ctools-export-ui-operations',
    ),
  );

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