ENHANCEMENT: Additional extension points for Tiny MCE editing, for when images are regenerated and manipulating the HTML prior to a save

This commit is contained in:
Gordon Anderson 2014-12-10 14:36:45 +07:00
parent d28992a1e5
commit fba688018f

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();
}