Created
July 11, 2018 17:24
-
-
Save calcio/49bb1d0b1b5f6fa4de3ebb711c442dfd to your computer and use it in GitHub Desktop.
Custom Formatter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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