Skip to content
Snippets Groups Projects
Commit ec5c6be4 authored by jaapjansma's avatar jaapjansma
Browse files

Merge branch 'optionsHook' into 'master'

Update hook_civicrm_fieldOptions for new fieldNames

See merge request !10
parents 92b91f57 fda50e54
Branches master
No related tags found
1 merge request!10Update hook_civicrm_fieldOptions for new fieldNames
......@@ -70,20 +70,16 @@ function areas_civicrm_container(ContainerBuilder $container) {
function areas_civicrm_fieldOptions($entity, $field, &$options, $params) {
if ($entity == 'Group') {
$config = \CRM_Areas_Config::singleton();
if ($field == 'custom_'.$config->getGroupAreasCustomFieldId()) {
$areas = civicrm_api3('Area', 'get', array('options' => array('limit' => 0)));
foreach($areas['values'] as $area) {
$options[$area['id']] = $area['title'];
}
if ($field == 'group_areas.group_areas' || $field == 'custom_'.$config->getGroupAreasCustomFieldId()) {
$areas = civicrm_api3('Area', 'get', ['options' => ['limit' => 0]]);
$options = array_column($areas['values'], 'title', 'id');
}
}
if ($entity == 'Contact') {
$config = CRM_Areas_Config::singleton();
if ($field == 'custom_'.$config->getContactAreasCustomFieldId()) {
$areas = civicrm_api3('Area', 'get', array('options' => array('limit' => 0)));
foreach($areas['values'] as $area) {
$options[$area['id']] = $area['title'];
}
if ($field == 'contact_areas.areas' || $field == 'custom_'.$config->getContactAreasCustomFieldId()) {
$areas = civicrm_api3('Area', 'get', ['options' => ['limit' => 0]]);
$options = array_column($areas['values'], 'title', 'id');
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment