Skip to main content
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
I learned the hard way that "HtmlOneLineField" does not work! But using "HtmlEditorField" as an alternativ, if you really only need one row, is wast of space and can be quit confusing for the user.
It seems as you can not change the number of rows delivered by "HtmlEditorField". Or can you? I would be more then greatful if anyone could show me how.
Anyone with a good idea how to deal with this problem?
Do you have some code to share?
Well, I tried something like this:
$fields->addFieldToTab('Root.Content.Main', new HtmlOneLineField('Sidrubrik', 'Sidrubrik, engelsk'), 'Content');
And all I got back in the Admin was the decoration borders - no field! See attatched file!
My mistake... I did some digging in the api docs and found the field to be deprecated. For a single line you can use HtmlEditorField with this format:
$name = 'Sidrubrik',
$title = 'Sidrubrik, engelsk',
$rows = 1
Let me know if you have success.
Thanks for your suggestion but I have tried setting $rows=1 and it doesn't work, same sad result, 15 rows or none. $rows is a protected variable!
Also tried 'hacking' but my php knowledge is limited so I had to giv in, for now at least.
Well, I had to dig into this to find out what was going on - didn't want to leave you hanging.
I do think this is more of a css or js issue than php. The html code generated does include inline css to set style: height. There is a min-height specified somewhere on the elements surrounding the actual editor field that's making it look like it's staying propped open.
Maybe someone from Core Dev. can help us to understand how to get this to work?
Going any further is virtually impossible for an amatuer! Core Team??
Hi, I tried constructing a new HTMLeditorfield, but encountered same problem as above. I checking the html and I'm guessing that this height declaration in the iframe is propping the field open.
<iframe style="width: 100%;height: 220px ...>
HTH. I was just wondering if it was the missing piece of the puzzle.
I was trying to setup a style-able title field, but this minor backend annoyance is... annoying.
<div id="StyledTitle" class="field htmleditor"><label class="left" for="Form_EditForm_StyledTitle">Alternative Title Field with Styling Enabled</label>
<span class="middleColumn"><textarea class="htmleditor typography" rows="1" cols="20" style="width: 97%; height: 16px; display: none;" tinymce="true" id="Form_EditForm_StyledTitle" name="StyledTitle"></textarea>
<span id="mce_editor_0_parent" class="mceEditorContainer"><table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="97%" height="16"><tbody><tr><td align="center">
<iframe style="width: 100%;height: 220px;" allowtransparency="true" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0" border="0" class="mceEditorIframe" name="mce_editor_0" id="mce_editor_0" scrolling="no" width="100%" frameborder="0" height="16"></iframe></td></tr></tbody></table></span></span></div>
<div id="Date" class="field calendardate"><label class="left" for="Form_EditForm_Date">Date</label>