You are here

function theme_node_import_sample_data in Node import 6

Theme a table with sample data.

2 theme calls to theme_node_import_sample_data()
node_import_add_form in ./node_import.admin.inc
Creates a new import task by letting the user fill in a wizard.
node_import_task_details in ./node_import.admin.inc

File

./node_import.admin.inc, line 1210

Code

function theme_node_import_sample_data($data, $length = 0) {
  $header = NULL;
  foreach ((array) $data as $i => $fields) {
    foreach ((array) $fields as $j => $value) {
      if ($length > 0 && strlen($value) > $length) {
        $data[$i][$j] = check_plain(substr($value, 0, $length)) . ' ' . theme('placeholder', format_plural(strlen($value) - $length, t('(1 more character)'), t('(@count more characters)')));
      }
      else {
        $data[$i][$j] = check_plain($value);
      }
    }
  }
  if (!empty($data) > 0) {
    $header = array_shift($data);
  }
  else {
    $data = array(
      t('Empty data set.'),
    );
  }
  return theme('table', $header, $data);
}