Created
March 15, 2013 22:15
-
-
Save Berdir/5173521 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/core/modules/edit/lib/Drupal/edit/EditController.php b/core/modules/edit/lib/Drupal/edit/EditController.php | |
index e20d48f..815dca3 100644 | |
--- a/core/modules/edit/lib/Drupal/edit/EditController.php | |
+++ b/core/modules/edit/lib/Drupal/edit/EditController.php | |
@@ -134,11 +134,12 @@ public function fieldForm(EntityInterface $entity, $field_name, $langcode, $view | |
*/ | |
public function getUntransformedText(EntityInterface $entity, $field_name, $langcode, $view_mode) { | |
$response = new AjaxResponse(); | |
- | |
- $output = field_view_field($entity, $field_name, $view_mode, $langcode); | |
- $langcode = $output['#language']; | |
+ // Make sure the langcode that field API would use is used. Maybe that's | |
+ // what field_view_field() was used for? | |
+ $langcode = field_language($entity, $field_name, $langcode); | |
+ $translation = $entity->getTranslation($langcode, FALSE); | |
// Direct text editing is only supported for single-valued fields. | |
- $editable_text = check_markup($output['#items'][0]['value'], $output['#items'][0]['format'], $langcode, FALSE, array(FILTER_TYPE_TRANSFORM_REVERSIBLE, FILTER_TYPE_TRANSFORM_I | |
+ $editable_text = check_markup($translation->$field_name->value, $translation->$field_name->format, $langcode, FALSE, array(FILTER_TYPE_TRANSFORM_REVERSIBLE, FILTER_TYPE_TRANS | |
$response->addCommand(new FieldRenderedWithoutTransformationFiltersCommand($editable_text)); | |
return $response; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment