Skip to content
Permalink
Browse files

NEW HTMLEditorField default alignment setting

A config setting to control the default alignment of embedded media and images
  • Loading branch information...
jonom committed Dec 2, 2016
1 parent dbe0639 commit 24dc3428d9aa0830a1ab8a606ba67817e89a6263
Showing with 11 additions and 2 deletions.
  1. +11 −2 forms/HtmlEditorField.php
@@ -20,6 +20,12 @@ class HtmlEditorField extends TextareaField {
*/
private static $insert_width = 600;
/**
* @config
* @var string Default alignment for Images and Media. Options: leftAlone|center|left|right
*/
private static $media_alignment = 'leftAlone';
/**
* @config
* @var bool Should we check the valid_elements (& extended_valid_elements) rules from HtmlEditorConfig server side?
@@ -674,7 +680,9 @@ protected function getFieldsForOembed($url, $file) {
'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.')
)
),
HtmlEditorField::config()->get('media_alignment')
)->addExtraClass('last')
);
@@ -808,7 +816,8 @@ protected function getFieldsForImage($url, $file) {
'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.')
)
),
HtmlEditorField::config()->get('media_alignment')
)->addExtraClass('last')
);

0 comments on commit 24dc342

Please sign in to comment.
You can’t perform that action at this time.