Skip to content

Commit 5786e51

Browse files
author
Igor Chepurnoy
committed
Update BaseEnum.php
1 parent 7b03895 commit 5786e51

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

helpers/BaseEnum.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ abstract class BaseEnum
4141
*/
4242
private static $list;
4343

44+
/**
45+
* @var string message category
46+
*/
47+
public static $messageCategory = 'yii2mod.enum';
48+
4449
/**
4550
* Sets the value that will be managed by this type instance.
4651
*
@@ -134,7 +139,7 @@ public static function listData()
134139
self::$list[$class] = $reflection->getStaticPropertyValue('list');
135140
}
136141
$result = ArrayHelper::getColumn(self::$list[$class], function ($value) {
137-
return Yii::t('yii2mod.enum', $value);
142+
return Yii::t(self::$messageCategory, $value);
138143
});
139144
return $result;
140145
}
@@ -148,7 +153,7 @@ public static function getLabel($value)
148153
{
149154
$list = self::listData();
150155
if (isset($list[$value])) {
151-
return Yii::t('yii2mod.enum', $list[$value]);
156+
return Yii::t(self::$messageCategory, $list[$value]);
152157
}
153158
return null;
154159
}

0 commit comments

Comments
 (0)