mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
MINOR Optional dependency on ThumbnailStripField in HtmlEditorField, preparing the split of this field into a "basic" and "cms" version
This commit is contained in:
parent
41e51abd9a
commit
67cc18f5bf
@ -288,6 +288,10 @@ class HtmlEditorField_Toolbar extends RequestHandler {
|
||||
* @return Form
|
||||
*/
|
||||
function ImageForm() {
|
||||
if(!class_exists('ThumbnailStripField')) {
|
||||
throw new Exception('ThumbnailStripField class required for HtmlEditorField->ImageForm()');
|
||||
}
|
||||
|
||||
$fields = new FieldSet(
|
||||
new LiteralField(
|
||||
'Heading',
|
||||
@ -348,6 +352,10 @@ class HtmlEditorField_Toolbar extends RequestHandler {
|
||||
}
|
||||
|
||||
function FlashForm() {
|
||||
if(!class_exists('ThumbnailStripField')) {
|
||||
throw new Exception('ThumbnailStripField class required for HtmlEditorField->FlashForm()');
|
||||
}
|
||||
|
||||
$form = new Form(
|
||||
$this->controller,
|
||||
"{$this->name}/FlashForm",
|
||||
|
@ -77,6 +77,7 @@ class HtmlEditorFieldTest extends FunctionalTest {
|
||||
}
|
||||
|
||||
public function testExtendImageFormFields() {
|
||||
if(class_exists('ThumbnailStripField')) {
|
||||
$controller = new Controller();
|
||||
|
||||
$toolbar = new HtmlEditorField_Toolbar($controller, 'DummyToolbar');
|
||||
@ -84,6 +85,10 @@ class HtmlEditorFieldTest extends FunctionalTest {
|
||||
$imageForm = $toolbar->ImageForm();
|
||||
$this->assertTrue(HtmlEditorFieldTest_DummyImageFormFieldExtension::$update_called);
|
||||
$this->assertEquals($imageForm->Fields(), HtmlEditorFieldTest_DummyImageFormFieldExtension::$fields);
|
||||
} else {
|
||||
$this->markTestSkipped('Test requires cms module (ThumbnailStripfield class)');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user