You are here

public function AddURLProperty::buildConfigurationForm in Search API 8

Constructs a configuration form for a field based on this property.

Parameters

\Drupal\search_api\Item\FieldInterface $field: The field for which the configuration form is constructed.

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

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the complete form.

Return value

array The form structure.

Overrides ConfigurablePropertyInterface::buildConfigurationForm

File

src/Plugin/search_api/processor/Property/AddURLProperty.php, line 31

Class

AddURLProperty
Defines an "Item URL" property.

Namespace

Drupal\search_api\Plugin\search_api\processor\Property

Code

public function buildConfigurationForm(FieldInterface $field, array $form, FormStateInterface $form_state) {
  $configuration = $field
    ->getConfiguration();
  $form['absolute'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Generate absolute URL'),
    '#description' => $this
      ->t('Check this box to pass absolute URLs to the index. This can be useful when indexing multiple sites with a single search index.'),
    '#default_value' => $configuration['absolute'] ?? FALSE,
    '#return_value' => TRUE,
  ];
  return $form;
}