Skip to content

Instantly share code, notes, and snippets.

@kinglozzer
Last active December 18, 2015 22:49
Show Gist options
  • Save kinglozzer/5856871 to your computer and use it in GitHub Desktop.
Save kinglozzer/5856871 to your computer and use it in GitHub Desktop.
<?php
private static $image_alignment_options = null;
//....
new TextField('CaptionText', _t('HtmlEditorField.CAPTIONTEXT', 'Caption text')),
DropdownField::create(
'CSSClass',
_t('HtmlEditorField.CSSCLASS', 'Alignment / style'),
$this->getImageAlignmentOptions()
)->addExtraClass('last')
//....
public function getImageAlignmentOptions() {
$options = Config::inst()->get('HtmlEditorField', 'image_alignment_options');
if ($options) {
return $options;
} else {
return array(
'leftAlone' => _t('HtmlEditorField.CSSCLASSLEFTALONE', 'On the left, on its own.'),
'center' => _t('HtmlEditorField.CSSCLASSCENTER', 'Centered, on its own.'),
'left' => _t('HtmlEditorField.CSSCLASSLEFT', 'On the left, with text wrapping around.'),
'right' => _t('HtmlEditorField.CSSCLASSRIGHT', 'On the right, with text wrapping around.')
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment