/** * Parse the shortcode. */ public function shortcode($options, $content = null) { $object = new $this->class(); $this->form = FormFactory::createForm('shortcode', new FormType(), $object); $configs = Helper::keysToCamelCase($options); if ($content) { $configs['content'] = $content; } $form = FormFactory::createForm('shortcode', new FormType(), $object); $form->build(); $form->bind(array('shortcode' => $configs)); return call_user_func_array($this->callback, array($object)); }
/** * Get the request submited to tthe form from the global request * * @param array $request * @return mixed */ public function getFormRequest($request) { if (!is_array($request)) { return $request; } if (!$this->hasRequest($request)) { return null; } return Helper::keysToCamelCase($request[$this->id]); }
/** * Hydrate an object from an array * * @param type $object * @param type $data */ public function hydrateObject($object, $data) { foreach (Helper::keysToCamelCase($data) as $key => $data) { if ($this->reflection->hasProperty($key)) { $this->hydrate($object, $key, $data); } } }