- fixed validations on radio type - fixed date format for months - added custom fields storing on subscribe - fixed date widget (select today's date) - fixed validation on form widget
40 lines
948 B
PHP
40 lines
948 B
PHP
<?php
|
|
namespace MailPoet\Form\Block;
|
|
|
|
class Radio 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 .= '<span class="mailpoet_error_'.$block['id'].'"></span>';
|
|
|
|
foreach($block['params']['values'] as $option) {
|
|
$html .= '<label class="mailpoet_radio_label">';
|
|
|
|
$html .= '<input type="radio" class="mailpoet_radio" ';
|
|
|
|
$html .= 'name="'.$field_name.'" ';
|
|
|
|
$html .= 'value="'.esc_attr($option['value']).'" ';
|
|
|
|
$html .= (isset($option['is_checked']) && $option['is_checked'])
|
|
? 'checked="checked"' : '';
|
|
$html .= $field_validation;
|
|
|
|
$html .= ' /> '.esc_attr($option['value']);
|
|
|
|
$html .= '</label>';
|
|
}
|
|
|
|
$html .= '</p>';
|
|
|
|
return $html;
|
|
}
|
|
} |