1 <?php
2 /**
3 * WysiwygInput.php
4 *
5 * @author Elvyrra SAS
6 * @license http://rem.mit-license.org/ MIT
7 */
8
9 namespace Hawk;
10
11 /**
12 * This class describes the wysiwyg fields in forms. Wysiwyg behavior is computed by CKEditor library
13 * http://ckeditor.com/
14 *
15 * @package Form\Input
16 */
17 class WysiwygInput extends TextareaInput{
18 const TYPE = "textarea";
19
20 /**
21 * Constructor
22 *
23 * @param array $param The input parameters. This arguments is an associative array where each key is the name of a property of this class
24 */
25 public function __construct($param){
26 parent::__construct($param);
27
28 $this->attributes['ko-wysiwyg'] = '1';
29 }
30
31
32 /**
33 * Display the input
34 *
35 * @return string the HTML result of the input displaying
36 */
37 public function display(){
38 Controller::current()->addJavaScriptInline('ko.applyBindingsToNode(document.getElementById("' . $this->id . '"), { wysiwyg : 1});');
39
40 return parent::display();
41 }
42
43 }
44