Returns responses for Editor module routes.
Expanded class hierarchy of EditorController
class EditorController extends ContainerAware {
/**
* Returns an Ajax response to render a text field without transformation filters.
*
* @param int $entity
* The entity of which a processed text field is being rerendered.
* @param string $field_name
* The name of the (processed text) field that that is being rerendered
* @param string $langcode
* The name of the language for which the processed text field is being
* rererendered.
* @param string $view_mode
* The view mode the processed text field should be rerendered in.
*
* @return \Drupal\Core\Ajax\AjaxResponse
* The Ajax response.
*/
public function getUntransformedText(EntityInterface $entity, $field_name, $langcode, $view_mode) {
$response = new AjaxResponse();
// Direct text editing is only supported for single-valued fields.
$field = $entity
->getTranslation($langcode, FALSE)->{$field_name};
$editable_text = check_markup($field->value, $field->format, $langcode, FALSE, array(
FILTER_TYPE_TRANSFORM_REVERSIBLE,
FILTER_TYPE_TRANSFORM_IRREVERSIBLE,
));
$response
->addCommand(new GetUntransformedTextCommand($editable_text));
return $response;
}
}
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ContainerAware:: |
protected | property | @api | |
ContainerAware:: |
public | function |
Sets the Container associated with this Controller. Overrides ContainerAwareInterface:: |
|
EditorController:: |
public | function | Returns an Ajax response to render a text field without transformation filters. |