You are here

function oa_core_refresh_section_values in Open Atrium Core 7.2

Update the section values in a way that skips cache, etc.

1 string reference to 'oa_core_refresh_section_values'
oa_core_form_views_content_views_panes_content_type_edit_form_alter in ./oa_core.module
Implements hook_form_FORM_ID_alter().

File

./oa_core.module, line 1270

Code

function oa_core_refresh_section_values($element) {
  $element['#options'] = array_intersect_key($element['#options'], array(
    NULL => '',
    'All' => '',
  ));
  $values = entityreference_get_selection_handler(field_info_field('oa_section_ref'))
    ->getReferencableEntities();
  if ($values) {
    $element['#options'] += current($values);
  }
  if ($element['#value'] && !array_key_exists($element['#value'], $element['#options'])) {
    $element['#value'] = 'All';
  }
  return $element;
}