You are here

public function CiviCrmCoreFields::fetchOptionsValue in CRM Core 7

Returns value based on the option_group and option_value database tables.

1 call to CiviCrmCoreFields::fetchOptionsValue()
CiviCrmCoreFields::prepareRow in modules/crm_core_data_import/plugins/conversion/CiviCrmCoreFields.inc
Process row of data.

File

modules/crm_core_data_import/plugins/conversion/CiviCrmCoreFields.inc, line 166

Class

CiviCrmCoreFields

Code

public function fetchOptionsValue($group_name, $value) {
  $params = array(
    'name' => $group_name,
  );
  $option_group = crm_core_data_import_civicrm_api('option_group', 'get', $params);
  $option_group = reset($option_group);
  if (!empty($option_group['id'])) {
    $options = array(
      'option_group_id' => $option_group['id'],
      'value' => $value,
    );
    $type = crm_core_data_import_civicrm_api('option_value', 'get', $options);
    $type = reset($type);
    return $type['name'];
  }
  return FALSE;
}