You are here

public function geofieldProximityOtherGeofield::options_form in Geofield 7.2

Overrides geofieldProximityBase::options_form

File

views/proximity_plugins/geofieldProximityOtherGeofield.inc, line 15
Contains geofieldProximityOtherGeofield.

Class

geofieldProximityOtherGeofield
@file Contains geofieldProximityOtherGeofield.

Code

public function options_form(&$form, &$form_state, $views_plugin) {
  $handlers = $views_plugin->view->display_handler
    ->get_handlers('field');
  $other_geofield_options = array(
    '' => '- None -',
  );
  foreach ($handlers as $handle) {
    if (!empty($handle->field_info['type']) && $handle->field_info['type'] == 'geofield') {
      $other_geofield_options[$handle->options['id']] = !empty($handle->options['label']) ? $handle->options['label'] : $handle->options['id'];
    }
  }
  $form['geofield_proximity_other_geofield'] = array(
    '#type' => 'select',
    '#title' => t('Other Geofield'),
    '#description' => t('List of other geofields attached to this view.'),
    '#default_value' => $views_plugin->options['geofield_proximity_other_geofield'],
    '#options' => $other_geofield_options,
    '#dependency' => array(
      'edit-options-source' => array(
        'other_geofield',
      ),
    ),
  );
}