You are here

function slickgrid_get_fields_of_type in Slickgrid 7

Same name and namespace in other branches
  1. 7.2 slickgrid.module \slickgrid_get_fields_of_type()

Get all fields of a aprticular type

Parameters

string $type:

string $entity_type:

File

./slickgrid.module, line 494

Code

function slickgrid_get_fields_of_type($type, $entity_type = null) {
  $query = db_select('field_config', 'fc');
  $query
    ->fields('fc', array(
    'field_name',
  ));
  $query
    ->condition('type', $type, '=');
  if (!is_null($entity_type)) {
    $query
      ->join('field_config_instance', 'fci', 'fci.field_id = fc.field_id');

    //JOIN node with users
    $query
      ->condition('entity_type', $entity_type);
  }
  $result = $query
    ->execute();
  return $result
    ->fetchAllKeyed();
}