Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Custom Formatter
<?php
namespace app\components\formatters;
use yii\i18n\Formatter;
class BrazilianFormatter extends Formatter
{
public static function asStatus($value)
{
return $value ? 'Active' : 'Inactive';
}
public static function asStatusHighlighted($value)
{
return $value ? '<span class="text-info"><strong>Active</strong></span>' :
'<span class="text-warning"><strong>Inactive</strong></span>';
}
public static function asHighlight($value)
{
return $value ? 'Yes' : 'No';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.