forked from modstart/ModStartBlog
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNavOpenType.php
More file actions
36 lines (29 loc) · 714 Bytes
/
Copy pathNavOpenType.php
File metadata and controls
36 lines (29 loc) · 714 Bytes
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
<?php
namespace Module\Nav\Type;
use ModStart\Core\Type\BaseType;
class NavOpenType implements BaseType
{
const CURRENT_WINDOW = 1;
const NEW_BLANK = 2;
public static function getList()
{
return [
self::CURRENT_WINDOW => '当前窗口',
self::NEW_BLANK => '新窗口',
];
}
public static function getBlankAttributeFromValue($nav)
{
if (empty($nav)) {
return '';
}
if (is_array($nav)) {
$nav = isset($nav['openType']) ? $nav['openType'] : null;
}
switch ($nav) {
case self::NEW_BLANK:
return 'target="_blank"';
}
return '';
}
}