in Web Development

PyroCMS: Getting a WYSIWG text box in your module

I know I said Pyro would be put on the back burner for a bit but I ran across something that I think is worth sharing.

So working on my module and I wanted a WYSIWG editor in the admin portion.  Took a look at the blog module that’s part of core and saw that there needed to be a style associated to that textarea. So I did that, but it didn’t work.

Long story short you need to put this in your controller when your view is loaded. So you’d have something like this when your view is loaded (you also need to have a style on your textarea box as well).

$this->template
->title($this->module_details['name'])
->append_metadata($this->load->view('fragments/wysiwyg', array(), true))
->set('foobar',$foobar)
->build('admin/edit');

As near as I can tell this isn’t documented anywhere. I also suspect there some other ‘root’ level libraries that need to be loaded for your development purposes.

Code on!

Comments are closed.