You are here

public function IndexBreakLockForm::buildForm in Search API 8

Form constructor.

Parameters

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

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

Return value

array The form structure.

Overrides EntityConfirmFormBase::buildForm

File

src/Form/IndexBreakLockForm.php, line 122

Class

IndexBreakLockForm
Builds the form to break the lock of an edited search index.

Namespace

Drupal\search_api\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  if (!$this->tempStore
    ->getMetadata($this->entity
    ->id())) {
    $form['message']['#markup'] = $this
      ->t('There is no lock on search index %name to break.', [
      '%name' => $this->entity
        ->id(),
    ]);
    return $form;
  }
  return parent::buildForm($form, $form_state);
}