You are here

function ctools_export_default_list in Chaos Tool Suite (ctools) 7

Same name and namespace in other branches
  1. 6 includes/export.inc \ctools_export_default_list()

Default function for listing bulk exportable objects.

2 calls to ctools_export_default_list()
bulk_export_export in bulk_export/bulk_export.module
FAPI gateway to the bulk exporter.
_ctools_drush_export_info in drush/ctools.drush.inc
Return array of CTools exportable info based on available tables returned from ctools_export_get_schemas().

File

includes/export.inc, line 1252
Contains code to make it easier to have exportable objects.

Code

function ctools_export_default_list($table, $schema) {
  $list = array();
  $items = ctools_export_crud_load_all($table);
  $export_key = $schema['export']['key'];
  foreach ($items as $item) {

    // Try a couple of possible obvious title keys:
    $keys = array(
      'admin_title',
      'title',
    );
    if (isset($schema['export']['admin_title'])) {
      array_unshift($keys, $schema['export']['admin_title']);
    }
    $string = '';
    foreach ($keys as $key) {
      if (!empty($item->{$key})) {
        $string = $item->{$key} . " (" . $item->{$export_key} . ")";
        break;
      }
    }
    if (empty($string)) {
      $string = $item->{$export_key};
    }
    $list[$item->{$export_key}] = check_plain($string);
  }
  return $list;
}