Hi,
I'm trying to customize the SimpleTinyMce in my DOM pop_up using the code supplied in Uncle Cheese's thread: http://www.silverstripe.org/dataobjectmanager-module-forum/show/262243?start=0
I am getting an error with the following code regarding SimpleTinyMce:
<?php
class Link extends DataObject
{
static $db = array (
'AltText' => 'Varchar(50)',
'TitleText' => 'Varchar(50)',
'Description' => 'Text',
'LinkUrl' => 'Varchar(50)'
);
static $has_one = array (
'LinksPage' => 'LinksPage',
'LinkImage' => 'Image'
);
public function getDOMThumbnail()
{return $this->LinkImage()->CroppedImage(50,50);}
function getCMSFields_forPopup()
{
return new FieldSet(
new ImageField('LinkImage'),
new TextField('AltText'),
new TextField('TitleText'),
new TextField('LinkUrl'),
$myfield = new SimpleTinyMCEField('Description');
$myfield->setButtons(array(
'cut,paste,|,undo,code','bold,italic,underline,|,justifyleft,justifyright'));
}
}
?>
I've also tried adding the following to my _config.php file instead:
SimpleTinyMCEField::set_default_buttons(array(
'cut,paste,|,undo,code',
'bold,italic,underline,|,justifyleft,justifyright'
));
And changing the previous code to:
...
function getCMSFields_forPopup()
{
return new FieldSet(
new ImageField('LinkImage'),
new TextField('AltText'),
new TextField('TitleText'),
new SimpleTinyMCEField('Description'),
new TextField('LinkUrl')
);
}
That doesn't work either. Nothing happens. None of the text formatting options are there. Just looks like a plain text form in the pop-up.
Alternatively, I also tried using SimpleWysiwygField. Still nothing.
In the _config.php file I put:
SimpleWysiwygField::set_default_configuration(array(
array('cut','copy','paste','|','bold','italic','underline','|','left','center','right'),
array('ol','ul','|','hyperlink','unlink','image','|','formats')
));
In the Link.php file, I put:
new SimpleWysiwygField('Description'));
Any help would be appreciated,
Sam