You are here

public function KeywordSettingsForm::addDisplay in Alinks 8

Parameters

array $form:

\Drupal\Core\Form\FormStateInterface $form_state:

File

src/Form/KeywordSettingsForm.php, line 67

Class

KeywordSettingsForm
Class KeywordSettingsForm.

Namespace

Drupal\alinks\Form

Code

public function addDisplay(array &$form, FormStateInterface $form_state) {
  if ($form_state
    ->getValue('entityType') && $form_state
    ->getValue('entityDisplay')) {
    $displays = $this
      ->configFactory()
      ->getEditable('alinks.settings')
      ->get('displays');
    $displays[] = [
      'entity_type' => $form_state
        ->getValue('entityType'),
      'entity_bundle' => $form_state
        ->getValue('entityBundle'),
      'entity_display' => $form_state
        ->getValue('entityDisplay'),
    ];
    $this
      ->configFactory()
      ->getEditable('alinks.settings')
      ->set('displays', $displays)
      ->set('vocabularies', $form_state
      ->getValue('vocabularies'))
      ->save();
  }
}