The title says it all. I have a custom field which is basically trying to replicate a textarea, but give that textarea a class so I can target it with some jQuery. The publish_form_field_unique hook seems to wipe out the whole form field area - taking the formatting dropdown and other things with it (smileys, glossary). But in my case, I would like the fomatting dropdown. I was able to hack it in, but it does not save the changes I make.
Rather than reinventing the wheel, I’d like to know if anyone has already made use of the formatting dropdown with a custom field.
I’ll take that as a “no”.
Let’s go a bit further. I’ve managed to get the formatting dropdown under my custom field. I can make a selection - say, switching from Xhtml to Textile - but it won’t save my selection. How is it I can add something to the field and save that, but if I switch the pulldown, it just pops back to what it was? Am I missing a hook?
I’ve attached a pic of a sample field from my Markitup extension to help illustrate what I’m talking about.
I basically ripped the text_formatting_buttons() function out of cp.publish.php (line 4980), stripped it of spellcheck, glossary, and smileys, put it into my extension as a private function (_text_formatting_buttons()) so that it would give me the formatting dropdown. For the field shown in the attached pic, the field format dropdown code looks like this:
<div class='xhtmlWrapper' >
<span class='lightLinks'></span>
<span class='xhtmlWrapperLight'>Formatting:</span>
<select name='field_ft_28' class='select' >
<option value='br'><br /></option>
<option value='markdown'>Markdown</option>
<option value='textile' selected='selected'>Textile</option>
<option value='xhtml'>Xhtml</option>
<option value='none'>None</option>
</select>
</div>
It is grabbing the right field id for the select name. Can anybody help me figure how how I can change that selection and have it save like a “real” textarea field? This is pretty much the last step so I can release the latest version of MD Markitup. Thanks.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.