public function DrupalFile::validateFileUploadSettings in Editor File upload 8
Validates the "file_upload" form element in settingsForm().
Moves the text editor's file upload settings from the DrupalFile plugin's own settings into $editor->file_upload.
See also
\Drupal\editor\Form\EditorFileDialog
editor_file_upload_settings_form()
File
- src/
Plugin/ CKEditorPlugin/ DrupalFile.php, line 83
Class
- DrupalFile
- Defines the "drupalfile" plugin.
Namespace
Drupal\editor_file\Plugin\CKEditorPluginCode
public function validateFileUploadSettings(array $element, FormStateInterface $form_state) {
$settings =& $form_state
->getValue($element['#parents']);
$editor = $form_state
->get('editor');
$keys = [
'status',
'scheme',
'directory',
'extensions',
'max_size',
];
foreach ($keys as $key) {
if (array_key_exists($key, $settings)) {
$editor
->setThirdPartySetting('editor_file', $key, $settings[$key]);
}
else {
$editor
->unsetThirdPartySetting('editor_file', $key);
}
}
$form_state
->unsetValue(array_slice($element['#parents'], 0, -1));
}