Re-enable capture'ing non-String values

This has been discussed in #17661 and partially reverts the changes made
in 9de83050d3a4b260d4aeb5d09ec4eb64f913ba64 and 986cac73e3c56b3dfa22fd1464f6913e38d32cc3

The test case added to content_for acts as a regression / acceptance test.
Merge pull request #18024 from carpodaster/fix/actionview/capture-non-strings

Re-enable capture'ing non-String values