/**
  * Merge all defaults with field specific defaults and set template if passed
  *
  * @param array $options
  */
 protected function setDefaultOptions(array $options = array())
 {
     $this->options = $this->formHelper->mergeOptions($this->allDefaults(), $this->getDefaults());
     $this->options = $this->prepareOptions($options);
     if (array_get($this->options, 'template') !== null) {
         $this->template = array_pull($this->options, 'template');
     }
 }
 /**
  * Render the form
  *
  * @param $options
  * @param $fields
  * @param boolean $showStart
  * @param boolean $showFields
  * @param boolean $showEnd
  * @return string
  */
 protected function render($options, $fields, $showStart, $showFields, $showEnd)
 {
     $formOptions = $this->formHelper->mergeOptions($this->formOptions, $options);
     return $this->formHelper->getView()->make($this->formHelper->getConfig('form'))->with(compact('showStart', 'showFields', 'showEnd'))->with('formOptions', $formOptions)->with('fields', $fields)->with('model', $this->getModel())->render();
 }