diff --git a/demos/collection/grid.php b/demos/collection/grid.php index a555f99126..0ed7b9845f 100644 --- a/demos/collection/grid.php +++ b/demos/collection/grid.php @@ -29,7 +29,7 @@ // add country flag column $grid->addColumn('flag', [ - Table\Column\Flag::class, + Table\Column\CountryFlag::class, 'codeField' => $model->fieldName()->iso, 'nameField' => $model->fieldName()->name, ]); diff --git a/src/Table/Column/CountryFlag.php b/src/Table/Column/CountryFlag.php new file mode 100644 index 0000000000..18b9803b77 --- /dev/null +++ b/src/Table/Column/CountryFlag.php @@ -0,0 +1,33 @@ +get($this->codeField); + $countryName = $this->nameField ? $row->get($this->nameField) : null; + + return [ + $field->shortName => $countryCode === null + ? '' + : $this->getApp()->getTag('i', [ + 'class' => strtolower($countryCode) . ' flag', + 'title' => strtoupper($countryCode) . ($countryName === null ? '' : ' - ' . $countryName), + ]), + ]; + } +} diff --git a/src/Table/Column/Flag.php b/src/Table/Column/Flag.php deleted file mode 100644 index 16c15f948f..0000000000 --- a/src/Table/Column/Flag.php +++ /dev/null @@ -1,34 +0,0 @@ -get($this->codeField); - $countryName = $this->nameField ? $row->get($this->nameField) : null; - - return [ - $field->shortName => $countryCode === null ? '' : $this->getApp()->getTag('i', [ - 'class' => strtolower($countryCode) . ' flag', - 'title' => $countryCode . ($countryName === null ? '' : ' - ' . $countryName), - ]), - ]; - } -}