/** * Normalize the sections. * * @param FormBuilder $builder */ public function normalize(FormBuilder $builder) { $sections = $builder->getSections(); foreach ($sections as $slug => &$section) { if (is_string($section)) { $section = ['view' => $section]; } } $builder->setSections($sections); }
/** * Normalize the sections. * * @param FormBuilder $builder */ public function normalize(FormBuilder $builder) { $sections = $builder->getSections(); foreach ($sections as $slug => &$section) { if (is_string($section)) { $section = ['view' => $section]; } /* * Make sure some default parameters exist. */ $section['attributes'] = array_get($section, 'attributes', []); /* * Move all data-* keys * to attributes. */ foreach ($section as $attribute => $value) { if (str_is('data-*', $attribute)) { array_set($section, 'attributes.' . $attribute, array_pull($section, $attribute)); } } } $builder->setSections($sections); }
/** * Evaluate the form sections. * * @param FormBuilder $builder */ public function evaluate(FormBuilder $builder) { $builder->setSections($this->evaluator->evaluate($builder->getSections(), compact('builder'))); }