diff --git a/core/modules/edit/edit.routing.yml b/core/modules/edit/edit.routing.yml index d66881d9a66..b2c0b438f8b 100644 --- a/core/modules/edit/edit.routing.yml +++ b/core/modules/edit/edit.routing.yml @@ -6,7 +6,7 @@ edit_metadata: _permission: 'access in-place editing' edit_field_form: - pattern: '/edit/form/{entity_type}/{entity}/{field_name}/{langcode}/{view_mode}' + pattern: '/edit/form/{entity_type}/{entity}/{field_name}/{langcode}/{view_mode_id}' defaults: _controller: '\Drupal\edit\EditController::fieldForm' requirements: diff --git a/core/modules/edit/lib/Drupal/edit/EditController.php b/core/modules/edit/lib/Drupal/edit/EditController.php index f64665b764b..da224bbeef9 100644 --- a/core/modules/edit/lib/Drupal/edit/EditController.php +++ b/core/modules/edit/lib/Drupal/edit/EditController.php @@ -91,12 +91,12 @@ class EditController extends ContainerAware { * The name of the field that is being edited. * @param string $langcode * The name of the language for which the field is being edited. - * @param string $view_mode + * @param string $view_mode_id * The view mode the field should be rerendered in. * @return \Drupal\Core\Ajax\AjaxResponse * The Ajax response. */ - public function fieldForm(EntityInterface $entity, $field_name, $langcode, $view_mode) { + public function fieldForm(EntityInterface $entity, $field_name, $langcode, $view_mode_id) { $response = new AjaxResponse(); $form_state = array( @@ -112,7 +112,7 @@ class EditController extends ContainerAware { $entity = entity_load($form_state['entity']->entityType(), $form_state['entity']->id(), TRUE); // @todo Remove when http://drupal.org/node/1346214 is complete. $entity = $entity->getBCEntity(); - $output = field_view_field($entity, $field_name, $view_mode, $langcode); + $output = field_view_field($entity, $field_name, $view_mode_id, $langcode); $response->addCommand(new FieldFormSavedCommand(drupal_render($output))); } diff --git a/core/modules/edit/lib/Drupal/edit/Tests/EditLoadingTest.php b/core/modules/edit/lib/Drupal/edit/Tests/EditLoadingTest.php index d3e5e9739ba..3d83d83976a 100644 --- a/core/modules/edit/lib/Drupal/edit/Tests/EditLoadingTest.php +++ b/core/modules/edit/lib/Drupal/edit/Tests/EditLoadingTest.php @@ -10,6 +10,7 @@ namespace Drupal\edit\Tests; use Drupal\simpletest\WebTestBase; use Drupal\edit\Ajax\MetadataCommand; use Drupal\Core\Ajax\AppendCommand; +use Drupal\Component\Utility\Unicode; /** * Tests loading of Edit and lazy-loading of in-place editors. @@ -137,6 +138,15 @@ class EditLoadingTest extends WebTestBase { ) )); $this->assertIdentical($command->render(), $ajax_commands[2], 'The Edit metadata command contains the expected metadata.'); + + // Retrieving the form for this field should result in a 200 response, + // containing only an editFieldForm command. + $response = $this->retrieveFieldForm('node/1/body/und/full'); + $this->assertResponse(200); + $ajax_commands = drupal_json_decode($response); + $this->assertIdentical(1, count($ajax_commands), 'The field form HTTP request results in three AJAX commands.'); + $this->assertIdentical('editFieldForm', $ajax_commands[0]['command'], 'The first AJAX command is an editFieldForm command.'); + $this->assertIdentical('