1 <?php
2 /**
3 * HtmlInput.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 html inputs. These objects are not really inputs, but can be used in forms to display HTML content betweeen other inputs,
13 * for instance short description of a set of inputs.
14 *
15 * @package Form\Input
16 */
17 class HtmlInput extends FormInput{
18 const TYPE = 'html';
19 const INDEPENDANT = true;
20
21 /**
22 * Defines if the content must be displayed as plain text
23 */
24 public $plainText = false;
25
26 /**
27 * Display the value of the input
28 *
29 * @return string The displayed HTML or text
30 */
31 public function display(){
32 if($this->plainText) {
33 $this->value = nl2br($this->value);
34 }
35
36 return parent::display();
37 }
38
39 /**
40 * Check the submitted value format. For this class, this method always return true, because no data can be submitted
41 *
42 * @param Form $form The form this "input" is associated with
43 *
44 * @return boolean True
45 */
46 public function check(&$form = null){
47 return true;
48 }
49
50 /**
51 * Get the value, formatted for MySQL database
52 *
53 * @return string The value itself
54 */
55 public function dbvalue(){
56 return $this->value;
57 }
58 }
59