Created
November 22, 2016 14:22
-
-
Save anonymous/9d1452418c63db8df1c8e111e31e4a57 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// View | |
<% loop ItemBlocks %> | |
<% if $Up.ShortCodeClass = $DatabaseClass %> | |
<div class="item <% if $Up.Size %> item-$Up.Size $Up.CC<% else %> item-1 <% end_if %> item-block"> | |
<div class="inner"> | |
<% if ItemImage %> | |
$ItemImage | |
<% end_if %> | |
<% if $Title %><h5>$Title</h5><% end_if %> | |
$Content | |
</div> | |
</div> | |
<% end_if %> | |
<% end_loop %> | |
// ShortCode| | |
// Shortcode to render group of ItemBlocks(from CMS /available per page / Part of extra fields) | |
// into HTML | |
public static function ShortCodeItemBlocks($arguments, $content = null, $parser = null, $tagname) { | |
if (isset($arguments['classgroup'])) { | |
if (!$arguments['classgroup']){ | |
return false; | |
} | |
$itemblock = Controller::curr(); | |
$itemblock->ShortCodeClass = $arguments['classgroup']; | |
if (isset($arguments['size'])) { | |
$itemblock->Size = $arguments['size']; | |
} | |
if (isset($arguments['customclass'])) { | |
$itemblock->CC = $arguments['customclass']; | |
} | |
return $itemblock->renderWith(array('Shortcodes', 'ItemBlocks')); | |
} else { | |
$itemblock = Controller::curr(); | |
if (isset($arguments['size'])) { | |
$itemblock->Size = $arguments['size']; | |
if (isset($arguments['customclass'])) { | |
$itemblock->CC = $arguments['customclass']; | |
} | |
} | |
return $itemblock->renderWith(array('Shortcodes', 'ItemBlocks')); | |
} | |
} | |
// USAGE IN CMS | |
[ItemBlocks, classgroup="something", size="3"] | |
[ItemBlocks, classgroup="other", size="3"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment