-
Notifications
You must be signed in to change notification settings - Fork 16
/
TextArea.php
30 lines (25 loc) · 1001 Bytes
/
TextArea.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
namespace Nibble\NibbleForms\Field;
class TextArea extends Text
{
public function __construct($label, $attributes)
{
parent::__construct($label, $attributes);
if (!isset($attributes['rows'])) {
$attributes['rows'] = 6;
}
if (!isset($attributes['cols'])) {
$attributes['cols'] = 60;
}
}
public function returnField($form_name, $name, $value = '')
{
$this->attributeString();
return array(
'messages' => !empty($this->custom_error) && !empty($this->error) ? $this->custom_error : $this->error,
'label' => $this->label == false ? false : sprintf('<label for="%s_%s" class="%s">%s</label>', $form_name, $name, $this->class, $this->label),
'field' => sprintf('<textarea name="%5$s[%1$s]" id="%5$s_%1$s" class="%2$s" %4$s>%3$s</textarea>', $name, $this->class, $value, $this->attribute_string, $form_name),
'html' => $this->html
);
}
}