Q: How to add wysiwyg editor in pyrocms module I have developed a PyroCMS custom module, but now I want to add WYSIWYG editor instead of the text area. 
How can I add it?

A: Just append this while building the template in the controller.
->append_metadata($this->load->view('fragments/wysiwyg', $this->data, TRUE))

and then 
echo form_textarea(array('id' => 'body', 'name' => 'code', 'value' => '', 'rows' => 30, 'class' => 'wysiwyg-advanced'));

Hopefully this will help you sometime..

A: Update:
With PyroCMS 2.2, $this->data has been deprecated.
In your controller you would need to change
->append_metadata($this->load->view('fragments/wysiwyg', $this->data, TRUE))

to
->append_metadata($this->load->view('fragments/wysiwyg', compact('items'), TRUE))

