function CKEditor5::getSubmittedFilterFormat
Same name in other branches
- 9 core/modules/ckeditor5/src/Plugin/Editor/CKEditor5.php \Drupal\ckeditor5\Plugin\Editor\CKEditor5::getSubmittedFilterFormat()
- 11.x core/modules/ckeditor5/src/Plugin/Editor/CKEditor5.php \Drupal\ckeditor5\Plugin\Editor\CKEditor5::getSubmittedFilterFormat()
Gets the submitted text format config entity from form state.
Needed for validation.
Parameters
\Drupal\Core\Form\FormStateInterface $filter_format_form_state: The text format configuration form's form state.
Return value
\Drupal\filter\FilterFormatInterface A FilterFormat config entity representing the current filter form state.
2 calls to CKEditor5::getSubmittedFilterFormat()
- CKEditor5::getEventualEditorWithPrimedFilterFormat in core/
modules/ ckeditor5/ src/ Plugin/ Editor/ CKEditor5.php - Gets the eventual text format config entity: from form state + editor.
- CKEditor5::validateSwitchingToCKEditor5 in core/
modules/ ckeditor5/ src/ Plugin/ Editor/ CKEditor5.php - Validate callback to inform the user of CKEditor 5 compatibility problems.
File
-
core/
modules/ ckeditor5/ src/ Plugin/ Editor/ CKEditor5.php, line 741
Class
- CKEditor5
- Defines a CKEditor 5-based text editor for Drupal.
Namespace
Drupal\ckeditor5\Plugin\EditorCode
protected static function getSubmittedFilterFormat(FormStateInterface $filter_format_form_state) : FilterFormatInterface {
$submitted_filter_format = clone $filter_format_form_state->getFormObject()
->getEntity();
assert($submitted_filter_format instanceof FilterFormatInterface);
// Get only the values of the filter_format form state that are relevant for
// checking compatibility. This logic is copied from FilterFormatFormBase.
// @see \Drupal\ckeditor5\Plugin\Validation\Constraint\FundamentalCompatibilityConstraintValidator
// @see \Drupal\filter\FilterFormatFormBase::submitForm()
$filter_format_form_values = array_intersect_key($filter_format_form_state->getValues(), array_flip([
'filters',
'filter_settings',
]));
foreach ($filter_format_form_values as $key => $value) {
if ($key !== 'filters') {
$submitted_filter_format->set($key, $value);
}
else {
foreach ($value as $instance_id => $config) {
$submitted_filter_format->setFilterConfig($instance_id, $config);
}
}
}
return $submitted_filter_format;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.