7913 Posts in 1355 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » HTML Field
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 1718 Views |
-
HTML Field

14 March 2011 at 4:53pm
Hey all,
I need an HTML editor field for my DataObject's Content field, which is managed in a data object manager popup window.
Problem:
SimpleHTMLEditorField: does not appear
SimpleTinyMCEField: renders a plain textarea
SimpleWYSIWYGField: also renders a plain textarea
I'm using SS 2.4.5 and the latest DOM.
This is my code:
HTMLWidget.php
class HTMLWidget extends DataObject
{
static $db = array(
"Title" => "Varchar",
"Content" => "HTMLText",
"Color" => "Varchar"
);
static $has_one = array(
"Page" => "Page"
);
function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Main", new TextField('Title', 'Widget Title'));
$fields->addFieldToTab("Root.Main", new TextField('Color', 'Title Background Color'));
$fields->addFieldToTab("Root.Main", new SimpleWYSIWYGField('Content', 'Content'));
return $fields;
}
}Page.php
class Page extends SiteTree
{public static $db = array(
);
static $has_many = array(
"HTMLWidget" => "HTMLWidget",
);function getCMSFields()
{
$fields = parent::getCMSFields();
$widgets = new DataObjectManager(
$this,
'HTMLWidget',
'HTMLWidget'
);
$fields->addFieldToTab("Root.Content.Widgets", $widgets);
return $fields;
}}
What do I gotta do!?
Thanks in advance
-
Re: HTML Field

14 March 2011 at 5:52pm
I think if you're on the latest version from GitHub, that bug is fixed.
git://github.com/unclecheese/DataObjectManager.git
-
Re: HTML Field

27 October 2011 at 2:45am Last edited: 27 October 2011 2:46am
hello all,
I have exactly the same problem:SimpleHTMLEditorField does not show up in cms popup.
Also with newest dataobject manager version...That´s my code:
class StartPage extends Page {
....
function getCMSFields() {
$fields = parent::getCMSFields();
$newsTablefield = new DataObjectManager(
$this,
'NewsItem',
'NewsItem',
array(
'Date' => 'Datum',
'Title' => 'Titel',
'Text' => 'Text'
),
'getCMSFields_forPopup'
);
$fields->addFieldToTab("Root.Content.Neuigkeiten", $newsTablefield);
return $fields;
}
}class NewsItem extends DataObject {
....
function getCMSFields_forPopup() {
$fields = new FieldSet();
$dateField = new DateField('Date','Datum');
$dateField->setConfig('showcalendar', true);
$dateField->setConfig('dateformat', 'dd.MM.YYYY');
$fields->push( $dateField );
$fields->push( new TextField('Title', 'Titel') );
$fields->push( new SimpleHTMLEditorField('Text', 'Text') );
return $fields;
}
}many thanks in advance,
Florian -
Re: HTML Field

12 November 2011 at 3:30am
Hi Florian,
I just had this same problem, then found that I should have been using 'SimpleTinyMCEField' instead of 'SimpleHTMLEditorField' and that worked for me.
| 1718 Views | ||
|
Page:
1
|
Go to Top |



