Skip to content

Instantly share code, notes, and snippets.

@wimleers
Forked from Berdir/gist:5173521
Created March 15, 2013 22:20
Show Gist options
  • Save wimleers/5173573 to your computer and use it in GitHub Desktop.
Save wimleers/5173573 to your computer and use it in GitHub Desktop.
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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment