#1043198: Change notice: Convert view modes to ConfigEntity converted view modes to entities. By virtue of the magic that is Drupal\Core\ParamConverter\EntityConverter
, this implies that any route that uses {view_mode}
will receive an upcasted view mode entity object instead of a view mode string identifier (like full
or teaser
).
edit.routing.yml
contains
edit_field_form:
pattern: '/edit/form/{entity_type}/{entity}/{field_name}/{langcode}/{view_mode}'
Hence upcasting is also applied to this route. But it's not expected nor needed by EditController::fieldForm(…, $view_mode)
. So the solution is to do a simple s/view_mode/view_mode_id/
in both the function arguments and the routing yml file.
The patch at #1043198: Change notice: Convert view modes to ConfigEntity forgot to update this part. But that's forgivable, because there should have been test coverage for this. That's my fault.
However, this was extremely hard to track down because it was not EditController::fieldForm()
that failed. It was the routing system itself that failed. Presumably because there's two different entities that are being upcasted in a single route: {entity}
and {view_mode}
. The result was an extremely unhelpful HTTP 404 status and A fatal error occurred:
, without any additional information, nor a watchdog entry.
This issue is solely about fixing Edit module, not about the above problem(s) in the routing system.
The exception itself is available at https://gist.github.com/wimleers/5591825.