/** * Register the Field Builder instance */ protected function registerFieldBuilder() { $this->app->bind('field', function ($app) { $this->loadConfigurationOptions(); $fieldBuilder = new FieldBuilder($app['form'], $this->theme, $app['translator']); if ($this->options['control_access']) { $fieldBuilder->setAccessHandler($app[AccessHandler::class]); } $fieldBuilder->setAbbreviations($this->options['abbreviations']); if (isset($this->options['theme_values']['field_classes'])) { $fieldBuilder->setCssClasses($this->options['theme_values']['field_classes']); } if (isset($this->options['theme_values']['field_templates'])) { $fieldBuilder->setTemplates($this->options['theme_values']['field_templates']); } if ($app['session.store']->has('errors')) { $fieldBuilder->setErrors($app['session.store']->get('errors')->toArray()); } return $fieldBuilder; }); }
/** * Set the current session errors. If a field contains errors, * they'll be render as part of the field's template. * * You must set them as an associative array of arrays, i.e.: * * [ * 'email' => ['Invalid email'] * 'password' => ['Needs upper case', 'Needs lower case', 'Needs klingon'] * ] * * @param array $errors * @static */ public static function setErrors($errors) { return \Styde\Html\FieldBuilder::setErrors($errors); }