You are here

public function IndexSolrMultisiteCloneForm::submitForm in Search API Solr 4.x

Same name and namespace in other branches
  1. 8.3 src/Form/IndexSolrMultisiteCloneForm.php \Drupal\search_api_solr\Form\IndexSolrMultisiteCloneForm::submitForm()

Throws

\ReflectionException

File

src/Form/IndexSolrMultisiteCloneForm.php, line 91

Class

IndexSolrMultisiteCloneForm
Provides a form for the Index entity.

Namespace

Drupal\search_api_solr\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  parent::submitForm($form, $form_state);

  /** @var \Drupal\search_api\IndexInterface $index */
  $index = $this
    ->getEntity();

  // We need to call Index::writeChangesToSettings to keep the field and
  // processor settings which are not part of this form. Index::preSave()
  // takes the shortcut and doesn't call Index::writeChangesToSettings because
  // an config entity created via createDuplicate() is considered as new, too.
  $reflection = new \ReflectionClass($index);
  $method = $reflection
    ->getMethod('writeChangesToSettings');
  $method
    ->setAccessible(TRUE);
  $method
    ->invoke($index);
}