/** @test */
 public function it_load_custom_field_types_from_config()
 {
     $config = $this->config;
     $config['custom_fields']['datetime'] = 'App\\Forms\\DatetimeType';
     $formHelper = new FormHelper($this->view, $this->request, $config);
     $this->assertEquals('App\\Forms\\DatetimeType', $formHelper->getFieldType('datetime'));
 }
 /**
  * Get the namespace from the config
  *
  * @return string
  */
 protected function getNamespaceFromConfig()
 {
     $namespace = $this->formHelper->getConfig('default_namespace');
     if (!$namespace) {
         return '';
     }
     return $namespace . '\\';
 }
 /**
  * Set up options on single field depending on form options
  *
  * @param string $name
  * @param $options
  */
 protected function setupFieldOptions($name, &$options)
 {
     if (!$this->isChildForm()) {
         return;
     }
     $options['real_name'] = $name;
     if (!isset($options['label'])) {
         $options['label'] = $this->formHelper->formatLabel($name);
     }
 }
 /**
  * Add error class to wrapper if validation errors exist
  *
  * @param $options
  */
 protected function addErrorClass(&$options)
 {
     $errors = $this->formHelper->getRequest()->getSession()->get('errors');
     if ($errors && $errors->has($this->name)) {
         $errorClass = $this->formHelper->getConfig('defaults.wrapper_error_class');
         if ($options['wrapper'] && !str_contains($options['wrapper']['class'], $errorClass)) {
             $options['wrapper']['class'] .= ' ' . $errorClass;
         }
     }
     return $options;
 }