Skip to content
This repository was archived by the owner on Aug 6, 2018. It is now read-only.

Commit 273d901

Browse files
committed
add 'thumbWithClass' tag for classified thumb styles
1 parent a461d78 commit 273d901

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

Module.php

+3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ public static function registerGlobalEventListeners()
2222

2323
public static function registerGlobalViewHelpers()
2424
{
25+
return array(
26+
'thumbWithClass' => 'Eva\EvaFileSystem\ViewHelpers\ThumbWithClass'
27+
);
2528
}
2629

2730
public static function registerGlobalRelations()

config/config.php

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
'allowExtensions' => 'jpg,png,jpeg,gif,rar,zip,7z,gz,doc,xls,docx,xlsx,ppt,pptx,pdf,mp3,mp4,wma',
1414
'minFileSize' => 1,
1515
'maxFileSize' => 1048576 * 20, //20MB
16+
'thumbClassSeparator'=>'!'
1617
),
1718
),
1819
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
namespace Eva\EvaFileSystem\ViewHelpers;
3+
4+
// +----------------------------------------------------------------------
5+
// | [wallstreetcn]
6+
// +----------------------------------------------------------------------
7+
// | Author: Mr.5 <mr5.simple@gmail.com>
8+
// +----------------------------------------------------------------------
9+
// + Datetime: 14-9-24 15:43
10+
// +----------------------------------------------------------------------
11+
// + ThumbWithClass.php
12+
// +----------------------------------------------------------------------
13+
14+
use Eva\EvaFileSystem\Entities\Files;
15+
16+
class ThumbWithClass extends Files
17+
{
18+
public function __invoke($filename, $class)
19+
{
20+
$config = $this->getConfig();
21+
$classSeparator = $config->thumbClassSeparator ? $config->thumbClassSeparator : '!';
22+
return $filename . $classSeparator . $class;
23+
}
24+
}

0 commit comments

Comments
 (0)