forked from kartik-v/yii2-dynagrid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDynaGridTrait.php
46 lines (42 loc) · 1.13 KB
/
DynaGridTrait.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
/**
* @package yii2-dynagrid
* @author Kartik Visweswaran <[email protected]>
* @copyright Copyright © Kartik Visweswaran, Krajee.com, 2015 - 2018
* @version 1.4.8
*/
namespace kartik\dynagrid;
use Yii;
/**
* Trait for dynagrid widgets
*
* @author Kartik Visweswaran <[email protected]>
* @since 1.0
*/
trait DynaGridTrait
{
/**
* Gets the category translated description
*
* @param string $cat the category 'grid', 'filter', or 'sort'
* @param boolean $initCap whether to capitalize first letter.
*
* @return string
*/
public static function getCat($cat, $initCap = false)
{
if ($initCap) {
return ucfirst(static::getCat($cat, false));
}
switch ($cat) {
case DynaGridStore::STORE_GRID:
return Yii::t('kvdynagrid', 'grid');
case DynaGridStore::STORE_SORT:
return Yii::t('kvdynagrid', 'sort');
case DynaGridStore::STORE_FILTER:
return Yii::t('kvdynagrid', 'filter');
default:
return Yii::t('kvdynagrid', $cat);
}
}
}