Presenter Output
This section will show you how to use the decorated value provided by the \Anomaly\CountryFieldType\CountryFieldTypePresenter class.
CountryFieldTypePresenter::code()
The code method returns the selected country's ISO code.
Returns: string
Example
$decorated->example->code();
Twig
{{ decorated.example.code() }}
CountryFieldTypePresenter::name()
The name method returns the name of the selected country.
Returns: string
Arguments
| Key | Required | Type | Default | Description |
|---|---|---|---|---|
|
$locale |
false |
string |
The active locale. |
The locale code to translate the name to. |
Example
$decorated->example->name('es');
Twig
{{ decorated.example.name('es') }}
CountryFieldTypePresenter::currency()
The currency method returns the country's currency information.
**Contribute:** If you have currency information to add or have found an error, submit a pull request to [https://github.com/anomalylabs/streams-platform](https://github.com/anomalylabs/streams-platform)
Returns: array or null
Example
$decorated->example->currency()['symbol'];
Twig
{{ decorated.example.currency().symbol }}
CountryFieldTypePresenter::locale()
The locale method returns the country's locale information.
**Contribute:** If you have locale information to add or have found an error, submit a pull request to [https://github.com/anomalylabs/streams-platform](https://github.com/anomalylabs/streams-platform)
Example
$decorated->example->locale()['direction'];
Twig
{{ decorated.example.locale().direction }}