- when a custom field is updated, the matching form field is now also updated - ability to toggle "is_required" on First name & Last name - fixed position of validation errors on segment selection, checkbox and radio - fixed form subscription not working when using custom fields - fixed sortable in segment selection after list update (add/remove) - updated position of messages in form subscription
42 lines
917 B
PHP
42 lines
917 B
PHP
<?php
|
|
namespace MailPoet\Form\Block;
|
|
|
|
class Checkbox 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);
|
|
|
|
foreach($block['params']['values'] as $option) {
|
|
$html .= '<label class="mailpoet_checkbox_label">';
|
|
|
|
$html .= '<input type="checkbox" class="mailpoet_checkbox" ';
|
|
|
|
$html .= 'name="'.$field_name.'" ';
|
|
|
|
$html .= 'value="1" ';
|
|
|
|
$html .= (isset($option['is_checked']) && $option['is_checked'])
|
|
? 'checked="checked"' : '';
|
|
$html .= $field_validation;
|
|
|
|
$html .= ' />'.$option['value'];
|
|
|
|
$html .= '</label>';
|
|
}
|
|
|
|
$html .= '<span class="mailpoet_error_'.$block['id'].'"></span>';
|
|
|
|
$html .= '</p>';
|
|
|
|
return $html;
|
|
}
|
|
}
|
|
|