CustomFields

- renamed form block type "input" to "text" for consistency with React
- updated CustomFields router to comply with main router
- unit tests for CF router
This commit is contained in:
Jonathan Labreuille
2016-01-29 17:14:01 +01:00
parent 24f96d9d7d
commit bb1cc997cc
11 changed files with 146 additions and 28 deletions

36
lib/Form/Block/Text.php Normal file
View File

@@ -0,0 +1,36 @@
<?php
namespace MailPoet\Form\Block;
class Text extends Base {
static function render($block) {
$type = 'text';
if($block['id'] === 'email') {
$type = 'email';
}
$html = '';
$html .= '<p class="mailpoet_paragraph">';
$html .= static::renderLabel($block);
$html .= '<input type="'.$type.'" class="mailpoet_text" ';
$html .= 'name="'.static::getFieldName($block).'" ';
$html .= 'title="'.static::getFieldLabel($block).'" ';
$html .= 'value="'.static::getFieldValue($block).'" ';
$html .= static::renderInputPlaceholder($block);
$html .= static::getInputValidation($block);
$html .= '/>';
$html .= '</p>';
return $html;
}
}