Skip to content

Instantly share code, notes, and snippets.

@kinglozzer
Created June 24, 2013 08:20
Show Gist options
  • Save kinglozzer/5848538 to your computer and use it in GitHub Desktop.
Save kinglozzer/5848538 to your computer and use it in GitHub Desktop.
'No alignment' option for images. Only tested on 3.0, though I imagine it would work on 3.1 fine. Apply with Object::add_extension('HtmlEditorField_Toolbar', 'HtmlEditorField_ToolbarExtension');
<?php
/**
* Add 'no alignment' option when inserting images through 'Insert Media' form
*/
class HtmlEditorField_ToolbarExtension extends Extension {
public function updateFieldsForImage(&$fields, $url, $file) {
$className = $fields->fieldByName('CSSClass');
$classes = $className->getSource();
$classes = array_merge(array('' => _t('HtmlEditorField.CSSCLASSNONE', 'No alignment.')), $classes);
$className->setSource($classes);
return $fields;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment