You are here

function node_field_db_field_select in Node Field 7.2

Get fields from database.

Parameters

array $values: Node fields matching these values will be selected from database.

Return value

array Array of node fields.

4 calls to node_field_db_field_select()
node_field_db_node_fields_select in model/node_field.db.inc
Select node node_fields.
node_field_handler_field_node_field::render in views/handlers/node_field_handler_field_node_field.inc
Render node fields.
node_field_load_node_field in includes/node_field.api.inc
Load node field.
node_field_taxonomy_term_delete in ./node_field.module
Implements hook_taxonomy_term_delete().

File

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

Code

function node_field_db_field_select(array $values = array()) {
  $query = db_select('node_field');
  $query
    ->fields('node_field');
  foreach ($values as $key => $value) {
    $query
      ->condition('node_field.' . $key, $value);
  }
  $query
    ->orderBy('weight', 'ASC');
  $result = $query
    ->execute();
  $result_fields = $result
    ->fetchAll(PDO::FETCH_ASSOC);
  $node_fields = [];
  foreach ($result_fields as $key => $node_field) {
    if (!empty($node_field['settings'])) {
      $result_fields[$key]['settings'] = unserialize($node_field['settings']);
    }
    else {
      $result_fields[$key]['settings'] = [];
    }
    $node_fields[$node_field['id']] = $result_fields[$key];
  }
  return $node_fields;
}