public EditorController::getUntransformedText(EntityInterface $entity, $field_name, $langcode, $view_mode_id)
Returns an Ajax response to render a text field without transformation filters.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity of which a formatted text field is being rerendered.
string $field_name: The name of the (formatted text) field that is being rerendered
string $langcode: The name of the language for which the formatted text field is being rerendered.
string $view_mode_id: The view mode the formatted text field should be rerendered in.
Return value
\Drupal\Core\Ajax\AjaxResponse The Ajax response.
File
- core/modules/editor/src/EditorController.php, line 36
Class
- EditorController
- Returns responses for Editor module routes.
Namespace
Drupal\editor
Code
public function getUntransformedText(EntityInterface $entity, $field_name, $langcode, $view_mode_id) { $response = new AjaxResponse(); // Direct text editing is only supported for single-valued fields. $field = $entity->getTranslation($langcode)->$field_name; $editable_text = check_markup($field->value, $field->format, $langcode, array(FilterInterface::TYPE_TRANSFORM_REVERSIBLE, FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE)); $response->addCommand(new GetUntransformedTextCommand($editable_text)); return $response; }
Please login to continue.