This course is archived!
This tutorial is built using Drupal 8.0. The fundamental concepts of Drupal 8 - like services & routing - are still valid, but newer versions of Drupal *do* have major differences.
12.
Service Arguments
Keep on Learning!
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
3 Comments
q: when you set @keyvalue argument you add quotes '@keyvalue'. Is that necessary? or it's a good practice?
Thanks.
GREAT question. It turns out, that according to the YAML spec, when you start a string with @, it means something special in YAML (I'm actually not sure what - I've never looked). So technically, if you have a value that happens to start with @, then you *must* (according to YAML rules) surround it with quotes. However, in Symfony 2.x, the YAML parser allowed you to *not* quote things. But in 3.0, the YAML parser follows the spec: you must quote it. So, get in the habit of quoting these strings now - and then your app will keep working when Drupal is eventually using Symfony 3 :).
Cheers!
cool. i'll follow your advise then.
Cheers!.
"Houston: no signs of life"
Start the conversation!