Last updated September 11, 2013. Created on September 7, 2013.
Edited by pwolanin. Log in to edit this page.

Manipulating the Request object:

Elements added to the attributes of the Request object by any Drupal module or service should have a _ prepended unless they come from the path. Example:


\Drupal::request()->attributes->set('_context_value', $myvalue);

Only values that come from the path will have the "_" omitted, for example, the the path pattern /node/{node}

Drupal core and Symfony typically add some prefixed attributes that should not be overwritten by a contributed module. These include:


(Note that _account is being removed in #2073531: Use current user service instead of _account, remove _account from the request object)

and from Symfony\Cmf\Component\Routing\RouteObjectInterface:


See the the original change notice

Looking for support? Visit the forums, or join #drupal-support in IRC.