You are here

public function PathFileEntitySettingsForm::submitForm in Path File 8

Form submission handler.

Parameters

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

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

Overrides ConfigFormBase::submitForm

File

src/Form/PathFileEntitySettingsForm.php, line 78

Class

PathFileEntitySettingsForm
Class PathFileEntitySettingsForm.

Namespace

Drupal\path_file\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $allowed_extensions = $form_state
    ->getValue('allowed_extensions');
  $config = $this
    ->config('path_file.settings');
  $config
    ->set('allowed_extensions', $allowed_extensions)
    ->save();

  // @TODO - is there a cleaner way to rebuild the field definition
  $field = $this->entityDefinitionUpdateManager
    ->getFieldStorageDefinition("fid", "path_file_entity");
  $this->entityDefinitionUpdateManager
    ->updateFieldStorageDefinition($field);
  parent::submitForm($form, $form_state);
}