Files
2016-11-07 12:56:17 -05:00

32 lines
1.0 KiB
Plaintext

@inherits umbraco.MacroEngines.DynamicNodeContext
@*
Macro to display a gallery from a media folder. Add the below parameter to the macro
and use it to point the macro at a specific media folder to display it's content as
a simple list.
Macro Parameters To Create, for this macro to work:
Alias:mediaId Name:Media Folder ID Type:Single Media Picker
*@
@if (Parameter.mediaId != null)
{
@* Get the media folder as a dynamic node *@
var mediaFolder = Library.MediaById(Parameter.mediaId);
if (mediaFolder.Children.Any())
{
<ul class="thumbnails">
@* for each item in children of the selected media folder *@
@foreach (var mediaItem in mediaFolder.Children)
{
<li class="span2">
<a href="@mediaItem.umbracoFile" class="thumbnail">
<img src="@mediaItem.umbracoFile" alt="@mediaItem.Name" />
</a>
</li>
}
</ul>
}
}