Commit 648c4aaf authored by xjm's avatar xjm
Browse files

Issue #3110200 by himanshu_sindhwani, kiamlaluno, tdnshah, xjm: Comments make...

Issue #3110200 by himanshu_sindhwani, kiamlaluno, tdnshah, xjm: Comments make a reference to filter_process_format(), which no longer exists
parent f09c8902
......@@ -138,9 +138,9 @@ protected function getSourceElement(LanguageInterface $source_language, $source_
* utilizing a form element of type 'text_format' and its #format and
* #allowed_formats properties. The access logic explained above is then
* handled by the 'text_format' element itself, specifically by
* filter_process_format(). In case such a rich element is not available for
* translation of complex data, similar access logic must be implemented
* manually.
* \Drupal\filter\Element\TextFormat::processFormat(). In case such a rich
* element is not available for translation of complex data, similar access
* logic must be implemented manually.
*
* @param \Drupal\Core\Language\LanguageInterface $translation_language
* The language to display the translation form for.
......@@ -153,7 +153,7 @@ protected function getSourceElement(LanguageInterface $source_language, $source_
* Form API array to represent the form element.
*
* @see \Drupal\config_translation\FormElement\TextFormat
* @see filter_process_format()
* @see \Drupal\filter\Element\TextFormat::processFormat()
*/
protected function getTranslationElement(LanguageInterface $translation_language, $source_config, $translation_config) {
// Add basic properties that apply to all form elements.
......
......@@ -47,9 +47,9 @@ public function preRenderTextFormat(array $element) {
return $element;
}
// filter_process_format() copies properties to the expanded 'value' child
// element, including the #pre_render property. Skip this text format
// widget, if it contains no 'format'.
// \Drupal\filter\Element\TextFormat::processFormat() copies properties to
// the expanded 'value' to the child element, including the #pre_render
// property. Skip this text format widget, if it contains no 'format'.
if (!isset($element['format'])) {
return $element;
}
......
......@@ -260,10 +260,11 @@ public static function processFormat(&$element, FormStateInterface $form_state,
* Render API callback: Hides the field value of 'text_format' elements.
*
* To not break form processing and previews if a user does not have access to
* a stored text format, the expanded form elements in filter_process_format()
* are forced to take over the stored #default_values for 'value' and
* 'format'. However, to prevent the unfiltered, original #value from being
* displayed to the user, we replace it with a friendly notice here.
* a stored text format, the expanded form elements in
* \Drupal\filter\Element\TextFormat::processFormat() are forced to take over
* the stored #default_values for 'value' and 'format'. However, to prevent
* the unfiltered, original #value from being displayed to the user, we
* replace it with a friendly notice here.
*
* @param array $element
* The render array to add the access denied message to.
......
......@@ -48,7 +48,8 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen
public function errorElement(array $element, ConstraintViolationInterface $violation, array $form, FormStateInterface $form_state) {
if ($violation->arrayPropertyPath == ['format'] && isset($element['format']['#access']) && !$element['format']['#access']) {
// Ignore validation errors for formats if formats may not be changed,
// i.e. when existing formats become invalid. See filter_process_format().
// such as when existing formats become invalid.
// See \Drupal\filter\Element\TextFormat::processFormat().
return FALSE;
}
return $element;
......
......@@ -38,8 +38,9 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen
*/
public function errorElement(array $element, ConstraintViolationInterface $violation, array $form, FormStateInterface $form_state) {
if ($violation->arrayPropertyPath == ['format'] && isset($element['format']['#access']) && !$element['format']['#access']) {
// Ignore validation errors for formats if formats may not be changed,
// i.e. when existing formats become invalid. See filter_process_format().
// Ignore validation errors for formats that may not be changed,
// such as when existing formats become invalid.
// See \Drupal\filter\Element\TextFormat::processFormat().
return FALSE;
}
return $element;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment