Skip to content

Commit 80a6b1a

Browse files
committed
Changed templateFile loading
1 parent 9f845d3 commit 80a6b1a

1 file changed

Lines changed: 24 additions & 18 deletions

File tree

src/NasExt/Controls/FilterFormControl.php

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,17 @@ class FilterFormControl extends Control
4747
protected $dataFilter;
4848

4949

50+
public function __construct()
51+
{
52+
parent::__construct();
53+
54+
$reflection = $this->getReflection();
55+
$dir = dirname($reflection->getFileName());
56+
$name = $reflection->getShortName();
57+
$this->templateFile = $dir . DIRECTORY_SEPARATOR . $name . '.latte';
58+
}
59+
60+
5061
/**
5162
* @param \Closure|callable $dataFilter
5263
* @return FilterFormControl
@@ -80,17 +91,6 @@ public function setDefaultValues($values)
8091
}
8192

8293

83-
/**
84-
* @param string $file
85-
* @return FilterFormControl
86-
*/
87-
public function setTemplateFile($file)
88-
{
89-
$this->templateFile = $file;
90-
return $this;
91-
}
92-
93-
9494
/**
9595
* @return array $data
9696
*/
@@ -219,14 +219,20 @@ public function processReset(SubmitButton $button)
219219
*/
220220
public function getTemplateFile()
221221
{
222-
if ($this->templateFile) {
223-
return $this->templateFile;
224-
}
222+
return $this->templateFile;
223+
}
225224

226-
$reflection = $this->getReflection();
227-
$dir = dirname($reflection->getFileName());
228-
$name = $reflection->getShortName();
229-
return $dir . DIRECTORY_SEPARATOR . $name . '.latte';
225+
226+
/**
227+
* @param string $file
228+
* @return FilterFormControl
229+
*/
230+
public function setTemplateFile($file)
231+
{
232+
if ($file) {
233+
$this->templateFile = $file;
234+
}
235+
return $this;
230236
}
231237

232238

0 commit comments

Comments
 (0)