Merge pull request #3721 from gordonbanderson/TINY_MCE_EDIT_EXTENSION_POINTS

ENHANCEMENT: Additional extension points when editing with Tiny MCE
This commit is contained in:
Will Morgan 2014-12-10 10:03:57 +00:00
commit 03bf7324a9

View File

@ -140,8 +140,15 @@ class HtmlEditorField extends TextareaField {
// Add default empty title & alt attributes.
if(!$img->getAttribute('alt')) $img->setAttribute('alt', '');
if(!$img->getAttribute('title')) $img->setAttribute('title', '');
// Use this extension point to manipulate images inserted using TinyMCE, e.g. add a CSS class, change default title
// $image is the image, $img is the DOM model
$this->extend('processImage', $image, $img);
}
// optionally manipulate the HTML after a TinyMCE edit and prior to a save
$this->extend('processHTML', $htmlValue);
// Store into record
$record->{$this->name} = $htmlValue->getContent();
}