|
|
@ -49,6 +49,7 @@ class FormRenderer
|
|
|
|
|
|
|
|
|
|
|
|
Blade::directive('form_label', function ($expression) { return '<?php echo \Artmark\Forms\FormRenderer::instance()->renderLabel(' . $expression . '); ?>'; });
|
|
|
|
Blade::directive('form_label', function ($expression) { return '<?php echo \Artmark\Forms\FormRenderer::instance()->renderLabel(' . $expression . '); ?>'; });
|
|
|
|
Blade::directive('form_field', function ($expression) { return '<?php echo \Artmark\Forms\FormRenderer::instance()->renderField(' . $expression . '); ?>'; });
|
|
|
|
Blade::directive('form_field', function ($expression) { return '<?php echo \Artmark\Forms\FormRenderer::instance()->renderField(' . $expression . '); ?>'; });
|
|
|
|
|
|
|
|
Blade::directive('form_error', function ($expression) { return '<?php echo \Artmark\Forms\FormRenderer::instance()->renderError(' . $expression . '); ?>'; });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function beginForm(Form $form)
|
|
|
|
public function beginForm(Form $form)
|
|
|
@ -69,6 +70,25 @@ class FormRenderer
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function renderError(AbstractField $field, $template = '')
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!$field->hasErrors()) {
|
|
|
|
|
|
|
|
return '';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (is_string($template) && !empty($template)) {
|
|
|
|
|
|
|
|
$correctTemplate = $template;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
$correctTemplate = 'error';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return view('accessories.forms.' . $correctTemplate, [
|
|
|
|
|
|
|
|
'renderer' => $this,
|
|
|
|
|
|
|
|
'field' => $field,
|
|
|
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function endForm()
|
|
|
|
public function endForm()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return "</form>\n";
|
|
|
|
return "</form>\n";
|
|
|
|