File tree Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 99use Atk4 \Data \Model ;
1010use Atk4 \Ui \Exception ;
1111use Atk4 \Ui \Form ;
12+ use Atk4 \Ui \Table ;
1213use Mvorisek \Atk4 \Hintable \Data \HintablePropertyDef ;
1314
1415try {
@@ -269,6 +270,7 @@ protected function init(): void
269270 'type ' => 'string ' ,
270271 'ui ' => [
271272 'form ' => [Form \Control \Line::class],
273+ 'table ' => [Table \Column \CountryFlag::class],
272274 ],
273275 ])
274276 ->addField ($ this ->fieldName ()->client_country , Country::hinting ()->fieldName ()->name );
Original file line number Diff line number Diff line change @@ -456,7 +456,13 @@ protected function parseTemplate(string $str): void
456456 $ this ->tagTrees = [];
457457 try {
458458 $ this ->tagTrees [self ::TOP_TAG ] = $ this ->parseTemplateTree ($ inputReversed );
459- self ::$ _parseCache [$ cKey ] = $ this ->tagTrees ;
459+ $ tagTrees = $ this ->tagTrees ;
460+ \Closure::bind (function () use ($ tagTrees ) {
461+ foreach ($ tagTrees as $ tagTree ) {
462+ $ tagTree ->parentTemplate = null ; // @phpstan-ignore-line
463+ }
464+ }, null , TagTree::class)();
465+ self ::$ _parseCache [$ cKey ] = $ tagTrees ;
460466 } finally {
461467 $ this ->tagTrees = null ; // @phpstan-ignore-line
462468 }
Original file line number Diff line number Diff line change 1111class CountryFlag extends Table \Column
1212{
1313 /** Name of country code model field (in ISO 3166-1 alpha-2 format) */
14- public string $ codeField ;
14+ public ? string $ codeField = null ;
1515
1616 /** Optional name of model field which contains full country name. */
1717 public ?string $ nameField = null ;
1818
1919 public function getHtmlTags (Model $ row , ?Field $ field ): array
2020 {
21- $ countryCode = $ row ->get ($ this ->codeField );
21+ $ countryCode = $ row ->get ($ this ->codeField ?? $ field -> shortName );
2222 $ countryName = $ this ->nameField ? $ row ->get ($ this ->nameField ) : null ;
2323
2424 return [
You can’t perform that action at this time.
0 commit comments