You are here

public function Map::buildConfigurationForm in Search API Location 8

Form constructor.

Plugin forms are embedded in other forms. In order to know where the plugin form is located in the parent form, #parents and #array_parents must be known, but these are not available during the initial build phase. In order to have these properties available when building the plugin form's elements, let this method return a form element that has a #process callback and build the rest of the form in the callback. By the time the callback is executed, the element's #parents and #array_parents properties will have been set by the form API. For more documentation on #parents and #array_parents, see \Drupal\Core\Render\Element\FormElement.

Parameters

array $form: An associative array containing the initial structure of the plugin form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form. Calling code should pass on a subform state created through \Drupal\Core\Form\SubformState::createForSubform().

Return value

array The form structure.

Overrides LocationInputPluginBase::buildConfigurationForm

File

src/Plugin/search_api_location/location_input/Map.php, line 56

Class

Map
Represents the Raw Location Input.

Namespace

Drupal\search_api_location\Plugin\search_api_location\location_input

Code

public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
  $form['radius_border_color'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Border color'),
    '#description' => $this
      ->t('The hexadecimal value of the radius border color.'),
    '#default_value' => $this->configuration['radius_border_color'],
    '#size' => 7,
  ];
  $form['radius_border_weight'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Border weight'),
    '#description' => $this
      ->t('The radius border weight in pixels.'),
    '#default_value' => $this->configuration['radius_border_weight'],
    '#size' => 3,
  ];
  $form['radius_background_color'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Fill color'),
    '#description' => $this
      ->t('The hexadecimal value of the fill color.'),
    '#default_value' => $this->configuration['radius_background_color'],
    '#size' => 7,
  ];
  $form['radius_background_transparency'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Fill transparency'),
    '#description' => $this
      ->t('The opacity of the fill color (a value between 0.0 and 1.0)'),
    '#default_value' => $this->configuration['radius_background_transparency'],
    '#size' => 3,
  ];
  $form['marker_image'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Marker image'),
    '#description' => $this
      ->t('The path to the marker image.'),
    '#default_value' => $this->configuration['marker_image'],
  ];
  return $form;
}