Created
October 25, 2016 09:44
-
-
Save anonymous/012e5309b9b69434c25864f176177aca 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
// Shortcode to add Items (add layout to the page) | |
public static function ShortcodeItem($arguments, $content = null, $parser = null, $tagName) { | |
$item = new ArrayList(); | |
$item->Content = DBField::create('HTMLText', $content); | |
if (isset($arguments['size']) && $arguments['size'] != '') { | |
$item->Size = $arguments['size']; | |
} else { | |
$item->Size = '2'; | |
} | |
if (isset($arguments['first'])) { | |
$item->Style = 'margin-left: 0; padding-left: 0;'; | |
} | |
if (isset($arguments['last'])) { | |
$item->Style = 'margin-right: 0; padding-right: 0;'; | |
} | |
if (isset($arguments['position']) && $arguments['position'] !== '') { | |
$position = $arguments['position']; | |
if ($position == 'right') { | |
$item->PositionStyle = 'float: right;'; | |
$item->Style = 'margin-right: 0; padding-right: 0;'; | |
} elseif ($position == 'center') { | |
$item->PositionStyle = 'float: none; clear: both; margin-left: auto; margin-right: auto;'; | |
} | |
} | |
if (isset($arguments['CustomClass']) && $arguments['CustomClass'] !== ''){ | |
$item->CC = $arguments['CustomClass']; | |
} | |
if (isset($arguments['offset']) && $arguments['offset'] !== ''){ | |
$item->OSize = $arguments['offset']; | |
} | |
return $item->renderWith(array('Shortcodes', 'Item')); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment