Files
piratepoet/lib/Form/Block/Select.php
Jonathan Labreuille 541696863e Form editor
- new/edit in forms listing goes to editor
- fixed editor dependencies (via Webpack)
- updated forms table schema
- saving/loading a form works
2015-11-06 16:09:09 +01:00

36 lines
961 B
PHP

<?php
namespace MailPoet\Form\Block;
class Select extends Base {
static function render($block) {
$html = '';
$field_name = static::getFieldName($block);
$field_validation = static::getInputValidation($block);
$html .= '<p class="mailpoet_paragraph">';
$html .= static::renderLabel($block);
$html .= '<select class="mailpoet_select" name="'.$field_name.'">';
if(isset($block['params']['label_within'])
&& $block['params']['label_within']) {
$html .= '<option value="">'.static::getFieldLabel($block).'</option>';
}
foreach($block['params']['values'] as $option) {
$is_selected = (isset($option['is_checked']) && $option['is_checked'])
? 'selected="selected"' : '';
$html .= '<option value="'.$option['value'].'" '.$is_selected.'>';
$html .= $option['value'];
$html .= '</option>';
}
$html .= '</select>';
$html .= '</p>';
return $html;
}
}