You are here

function node_field_node_reference_db_get_nodes in Node Field 7.2

Get nodes of the given content type.

Parameters

string $content_type: Content type machine name.

Return value

array Array of nodes of given content type

1 call to node_field_node_reference_db_get_nodes()
node_field_node_reference_widget in includes/node_field.field.inc
Widget for node_reference field.

File

model/node_field.db.inc, line 110
Database related functions for node_field module.

Code

function node_field_node_reference_db_get_nodes($content_type) {
  $query = db_select('node', 'n');
  $query
    ->fields('n', [
    'nid',
    'title',
  ]);
  $query
    ->condition('n.type', $content_type, '=');
  $result = $query
    ->execute();
  $items = $result
    ->fetchAllKeyed(0, 1);
  return $items;
}