1 <?php
2 /**
3 * Form.php
4 *
5 * @author Elvyrra SAS
6 * @license http://rem.mit-license.org/ MIT
7 */
8
9 namespace Hawk\View\Plugins;
10
11 /**
12 * This class is used to display a form in a view
13 *
14 * @package View\Plugins
15 */
16 class Form extends \Hawk\ViewPlugin{
17 /**
18 * The id of the form to display
19 *
20 * @var string
21 */
22 public $id,
23
24 /**
25 * The content of the form to display
26 *
27 * @var string
28 */
29 $content;
30
31 /**
32 * Display the form
33 */
34 public function display(){
35 $form = \Hawk\Form::getInstance($this->id);
36 if($form) {
37 if(isset($this->content)) {
38 return $form->wrap($this->content);
39 }
40 else{
41 return $form->display();
42 }
43 }
44 else{
45 return '';
46 }
47 }
48 }
49