forked from bdw429s/ColdBox-plugins-for-Twitter-Bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBreadCrumbs.cfc
More file actions
40 lines (36 loc) · 1.57 KB
/
BreadCrumbs.cfc
File metadata and controls
40 lines (36 loc) · 1.57 KB
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
<cfcomponent hint="Twitter Bootstrap MessageBox" output="false" extends="coldbox.system.plugins.MessageBox" cache="true">
<!------------------------------------------- CONSTRUCTOR ------------------------------------------->
<cffunction name="init" access="public" returntype="Breadcrumbs" output="false" hint="constructor">
<cfargument name="controller" type="any" required="true" />
<cfscript>
super.init(arguments.controller);
// Plugin Properties
setPluginName("Breadcrumbs");
setPluginVersion("1.0");
setPluginDescription("Twitter Bootstrapped Breadcrumbs");
setPluginAuthor("Adrian J. Moreno");
setPluginAuthorURL("http://iknowkungfoo.com");
return this;
</cfscript>
</cffunction>
<cffunction name="render" access="public" output="false" returntype="string" hint="I create a breadcrumb menu.">
<cfargument name="crumbs" type="array" required="true" hint="Array of structs: [{url,label}]" />
<cfargument name="active" type="string" required="true" hint="Text for active label (no link))." />
<cfset var event = getRequestContext()>
<cfset var results = "" />
<cfset var crumb = {} />
<cfsavecontent variable="results">
<cfoutput>
<ul class="breadcrumb">
<cfloop array="#arguments.crumbs#" index="crumb">
<cfif isStruct(crumb) AND !structIsEmpty(crumb)>
<li><a href="#event.buildLink(crumb.url)#">#crumb.label#</a> <span class="divider">/</span></li>
</cfif>
</cfloop>
<li class="active">#arguments.active#</li>
</ul>
</cfoutput>
</cfsavecontent>
<cfreturn results />
</cffunction>
</cfcomponent>