url = $url; $this->tokenProvider = $tokenProvider; } /** * Open up a new HTML form. * * @param array $options * @return string */ public function open(array $options = array()) { $method = strtoupper(array_get($options, 'method', 'post')); // We need to extract the proper method from the attributes. If the method is // something other than GET or POST we'll use POST since we will spoof the // actual method since forms don't support PUT or DELETE as native HTML. $attributes['method'] = $this->getMethod($method); $attributes['action'] = $this->getAction($options); $attributes['accept-charset'] = 'UTF-8'; // If the method is PUT or DELETE, we will need to add a spoofer hidden field // that will instruct this Symfony request to pretend that the method is a // different method than it actually is, for convenience from the forms. $append = $this->getAppendage($method); $attributes = array_merge( $attributes, array_except($options, $this->reserved) ); // Finally we're ready to create the final form HTML field. We will attribute // format the array of attributes. We will also add on the appendage which // is used to spoof the requests for PUT and DELETE requests to the app. $attributes = Html::attributes($attributes); return '