ctools_export_default_list

  1. drupal
    1. 6 export.inc function
    2. 7 export.inc function
Drupal 7 ctools_export_default_list($table, $schema)

Default function for listing bulk exportable objects.

3 calls to ctools_export_default_list()

File

sites/all/modules/ctools/includes/export.inc, line 1224
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;
}