public function VideoEmbedHtml5ConfigForm::submitForm in Video Embed HTML5 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/ VideoEmbedHtml5ConfigForm.php, line 85
Class
- VideoEmbedHtml5ConfigForm
- Class VideoEmbedHtml5ConfigForm @package Drupal\video_embed_html5\Form
Namespace
Drupal\video_embed_html5\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$config = $this
->config('video_embed_html5.config');
$config
->set('add_placeholder', $form_state
->getValue('add_placeholder'));
$config
->set('placeholder', $form_state
->getValue('placeholder'));
$config
->save();
if (!empty($form_state
->getValue('placeholder')[0])) {
// Record this module as using this file.
/** @var FileInterface $placeholder */
$placeholder = File::load($form_state
->getValue('placeholder')[0]);
$references = $this->fileUsage
->listUsage($placeholder);
if (empty($references)) {
$this->fileUsage
->add($placeholder, 'video_embed_html5', 'settings', 0);
}
}
parent::submitForm($form, $form_state);
}