@@ -37,6 +37,20 @@ abstract class AbstractNode
37
37
*/
38
38
protected $ icon ;
39
39
40
+ /**
41
+ * Optional HTML prefix for the node.
42
+ *
43
+ * @var string
44
+ */
45
+ protected $ prefix = '' ;
46
+
47
+ /**
48
+ * Optional HTML suffix for the node.
49
+ *
50
+ * @var string
51
+ */
52
+ protected $ suffix = '' ;
53
+
40
54
/**
41
55
* Array of icon resolvers.
42
56
*
@@ -55,7 +69,7 @@ abstract class AbstractNode
55
69
* @var array
56
70
*/
57
71
protected static $ notHtmlAttributes = [
58
- 'icon ' , 'href ' , 'affix ' , 'prefix ' , 'glyph ' ,
72
+ 'icon ' , 'href ' , 'suffix ' , 'prefix ' , 'glyph ' ,
59
73
'glyphicon ' , 'fa-icon ' , 'fa-stack '
60
74
];
61
75
@@ -67,7 +81,7 @@ abstract class AbstractNode
67
81
public static function addIconResolvers (array $ resolvers )
68
82
{
69
83
static ::$ iconResolvers = $ resolvers + static ::$ iconResolvers ;
70
- static ::$ notHtmlAttributes = array_merge (['icon ' , 'href ' , 'affix ' , 'prefix ' ],
84
+ static ::$ notHtmlAttributes = array_merge (['icon ' , 'href ' , 'suffix ' , 'prefix ' ],
71
85
array_keys (static ::$ iconResolvers ));
72
86
}
73
87
@@ -98,6 +112,13 @@ protected function parseAttributes(array $attributes)
98
112
$ attributes ['class ' ] = [];
99
113
}
100
114
115
+ if (isset ($ attributes ['suffix ' ])) {
116
+ $ this ->suffix = $ attributes ['suffix ' ];
117
+ }
118
+ if (isset ($ attributes ['prefix ' ])) {
119
+ $ this ->prefix = $ attributes ['prefix ' ];
120
+ }
121
+
101
122
$ attributes ['id ' ] = isset ($ attributes ['id ' ]) ? $ attributes ['id ' ] : Str::slug ($ this ->title );
102
123
103
124
return array_except ($ attributes , static ::$ notHtmlAttributes );
@@ -115,7 +136,7 @@ public function getId()
115
136
116
137
public function getTitle ()
117
138
{
118
- return $ this ->title ;
139
+ return $ this ->prefix . e ( $ this -> title ). $ this -> suffix ;
119
140
}
120
141
121
142
public function getAttributes ()
0 commit comments