You are here

function node_import_field_map_count in Node import 6

Returns the number of columns given $fieldname is mapped to.

Parameters

$fieldname: String.

$map: Array of file column mapping.

Return value

Integer. Number of file columns the field is mapped to.

Related topics

2 calls to node_import_field_map_count()
node_import_options in ./node_import.inc
Returns a list of options (form elements).
node_import_values in ./node_import.inc
Create an array of values to submit to the form.

File

./node_import.inc, line 1526
Public API of the Node import module.

Code

function node_import_field_map_count($fieldname, $map) {
  if (!isset($map[$fieldname])) {
    return 0;
  }
  if (!is_array($map[$fieldname])) {
    return strlen($map[$fieldname]) > 0;
  }
  $count = 0;
  foreach ($map[$fieldname] as $col) {
    if ($col !== '') {
      $count++;
    }
  }
  return $count;
}