public function GeofieldProximitySourceManager::buildCommonFormElements in Geofield 8
Builds the common elements of the Proximity Form.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
string $context: The array list of the specific view handler plugin type to look for. Possible values:
- filter
- sort
- field
- NULL (all).
bool $is_exposed: The check/differentiate if it is part of an exposed form.
File
- src/Plugin/ GeofieldProximitySourceManager.php, line 47 
Class
- GeofieldProximitySourceManager
- Provides the Geofield Proximity Source plugin manager.
Namespace
Drupal\geofield\PluginCode
public function buildCommonFormElements(array &$form, FormStateInterface $form_state, $context = NULL, $is_exposed = FALSE) {
  // Attach Geofield Map Libraries.
  $form['#attached']['library'][] = 'geofield/geofield_proximity';
  $form['units'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Unit of Measure'),
    '#description' => '',
    '#options' => geofield_radius_options(),
    '#default_value' => '',
  ];
  $form['source_intro'] = [
    '#markup' => $this
      ->t('How do you want to enter your proximity parameters (distance and origin point)?'),
  ];
  $form['source'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Proximity Definition Mode (Source of Distance and Origin Point)'),
    '#options' => [],
    '#default_value' => '',
    '#ajax' => [
      'callback' => [
        get_class($this),
        'sourceUpdate',
      ],
      'effect' => 'fade',
    ],
  ];
  foreach ($this
    ->getDefinitions() as $plugin_id => $definition) {
    if (isset($definition['context']) && (empty($definition['context']) || in_array($context, $definition['context'])) && (!isset($definition['exposedOnly']) || $definition['exposedOnly'] && $is_exposed) && (!isset($definition['no_ui']) || !$definition['no_ui'])) {
      $form['source']['#options'][$plugin_id] = $definition['label'];
    }
  }
  $form['source_configuration'] = [
    '#type' => 'container',
    '#tree' => TRUE,
    '#prefix' => '<div id="proximity-source-configuration">',
    '#suffix' => '</div>',
  ];
}