Skip to content

Commit f7e19e4

Browse files
committed
Tranfered bound templates to templates.php
1 parent 3fbff8e commit f7e19e4

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/Fields/BoundField.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@
33

44
use Fleshgrinder\Core\Formatter;
55

6+
use PHPForm\PHPFormConfig;
67
use PHPForm\Utils\Attributes;
78

89
class BoundField
910
{
10-
const LABEL_TEMPLATE = '<label for="{for}"[ {attrs}?]>{contents}[ {required}?]</label>';
11-
const LABEL_REQUIRED = '<span class="required">*</span>';
12-
1311
private $form;
1412
private $field;
1513
private $name;
@@ -98,11 +96,14 @@ public function labelTag($contents = null, array $attrs = null)
9896

9997
$widget = $this->field->getWidget();
10098

101-
return Formatter::format(self::LABEL_TEMPLATE, array(
99+
$label_tpl = PHPFormConfig::getITemplate("LABEL");
100+
$label_required_tpl = PHPFormConfig::getITemplate("LABEL_REQUIRED");
101+
102+
return Formatter::format($label_tpl, array(
102103
"for" => $widget->buildAutoId($this->html_name),
103104
"attrs" => $attrs,
104105
"contents" => $contents,
105-
"required" => $this->field->isRequired() ? $this::LABEL_REQUIRED : null
106+
"required" => $this->field->isRequired() ? $label_required_tpl : null
106107
));
107108
}
108109

src/templates.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
22

33
return array(
4+
"LABEL" => '<label for="{for}"[ {attrs}?]>{contents}[ {required}?]</label>',
5+
"LABEL_REQUIRED" => '<span class="required">*</span>',
46
);

0 commit comments

Comments
 (0)