本文整理汇总了PHP中cf7bs_get_form_property函数的典型用法代码示例。如果您正苦于以下问题:PHP cf7bs_get_form_property函数的具体用法?PHP cf7bs_get_form_property怎么用?PHP cf7bs_get_form_property使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cf7bs_get_form_property函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cf7bs_number_shortcode_handler
function cf7bs_number_shortcode_handler($tag)
{
$tag = new WPCF7_Shortcode($tag);
if (empty($tag->name)) {
return '';
}
$mode = $status = 'default';
$validation_error = wpcf7_get_validation_error($tag->name);
$class = wpcf7_form_controls_class($tag->type);
$class .= ' wpcf7-validates-as-number';
if ($validation_error) {
$class .= ' wpcf7-not-valid';
$status = 'error';
}
if ($tag->is_required()) {
$mode = 'required';
}
$value = (string) reset($tag->values);
$placeholder = '';
if ($tag->has_option('placeholder') || $tag->has_option('watermark')) {
$placeholder = $value;
$value = '';
}
if (wpcf7_is_posted() && isset($_POST[$tag->name])) {
$value = stripslashes_deep($_POST[$tag->name]);
} elseif (isset($_GET) && array_key_exists($tag->name, $_GET)) {
$value = stripslashes_deep(rawurldecode($_GET[$tag->name]));
}
$field = new CF7BS_Form_Field(array('name' => $tag->name, 'id' => $tag->get_option('id', 'id', true), 'class' => $tag->get_class_option($class), 'type' => wpcf7_support_html5() ? $tag->basetype : 'text', 'value' => $value, 'placeholder' => $placeholder, 'label' => $tag->content, 'options' => array('min' => $tag->get_option('min', 'signed_int', true), 'max' => $tag->get_option('max', 'signed_int', true), 'step' => $tag->get_option('step', 'int', true)), 'help_text' => $validation_error, 'size' => cf7bs_get_form_property('size'), 'grid_columns' => cf7bs_get_form_property('grid_columns'), 'form_layout' => cf7bs_get_form_property('layout'), 'form_label_width' => cf7bs_get_form_property('label_width'), 'form_breakpoint' => cf7bs_get_form_property('breakpoint'), 'mode' => $mode, 'status' => $status, 'readonly' => $tag->has_option('readonly') ? true : false, 'tabindex' => $tag->get_option('tabindex', 'int', true), 'wrapper_class' => $tag->name));
$html = $field->display(false);
return $html;
}
示例2: cf7bs_recaptcha_shortcode_handler
function cf7bs_recaptcha_shortcode_handler($tag)
{
$tag_obj = new WPCF7_Shortcode($tag);
$field = new CF7BS_Form_Field(cf7bs_apply_field_args_filter(array('name' => wpcf7_recaptcha_shortcode_handler($tag), 'type' => 'custom', 'label' => $tag_obj->content, 'grid_columns' => cf7bs_get_form_property('grid_columns'), 'form_layout' => cf7bs_get_form_property('layout'), 'form_label_width' => cf7bs_get_form_property('label_width'), 'form_breakpoint' => cf7bs_get_form_property('breakpoint'), 'tabindex' => false, 'wrapper_class' => ''), $tag_obj->basetype));
$html = $field->display(false);
return $html;
}
示例3: cf7bs_file_shortcode_handler
function cf7bs_file_shortcode_handler($tag)
{
$tag = new WPCF7_Shortcode($tag);
if (empty($tag->name)) {
return '';
}
$mode = $status = 'default';
$validation_error = wpcf7_get_validation_error($tag->name);
$class = wpcf7_form_controls_class($tag->type);
if ($validation_error) {
$class .= ' wpcf7-not-valid';
$status = 'error';
}
// size is not used since Bootstrap input fields always scale 100%
//$atts['size'] = $tag->get_size_option( '40' );
if ($tag->is_required()) {
$mode = 'required';
}
$value = (string) reset($tag->values);
$placeholder = '';
if ($tag->has_option('placeholder') || $tag->has_option('watermark')) {
$placeholder = $value;
$value = '';
} elseif (empty($value)) {
$value = $tag->get_default_option();
}
if (wpcf7_is_posted() && isset($_POST[$tag->name])) {
$value = stripslashes_deep($_POST[$tag->name]);
}
$field = new CF7BS_Form_Field(cf7bs_apply_field_args_filter(array('name' => $tag->name, 'id' => $tag->get_option('id', 'id', true), 'class' => $tag->get_class_option($class), 'type' => 'file', 'value' => '1', 'label' => $tag->content, 'help_text' => $validation_error, 'size' => cf7bs_get_form_property('size'), 'grid_columns' => cf7bs_get_form_property('grid_columns'), 'form_layout' => cf7bs_get_form_property('layout'), 'form_label_width' => cf7bs_get_form_property('label_width'), 'form_breakpoint' => cf7bs_get_form_property('breakpoint'), 'mode' => $mode, 'status' => $status, 'tabindex' => $tag->get_option('tabindex', 'int', true), 'wrapper_class' => $tag->name), $tag->basetype, $tag->name));
$html = $field->display(false);
return $html;
}
示例4: cf7bs_count_shortcode_handler
function cf7bs_count_shortcode_handler($tag)
{
$tag_obj = new WPCF7_Shortcode($tag);
if (empty($tag_obj->name)) {
return '';
}
$field = new CF7BS_Form_Field(array('name' => wpcf7_count_shortcode_handler($tag), 'type' => 'custom', 'label' => $tag_obj->content, 'grid_columns' => cf7bs_get_form_property('grid_columns'), 'form_layout' => cf7bs_get_form_property('layout'), 'form_label_width' => cf7bs_get_form_property('label_width'), 'form_breakpoint' => cf7bs_get_form_property('breakpoint'), 'tabindex' => false, 'wrapper_class' => ''));
$html = $field->display(false);
return $html;
}
示例5: cf7bs_captchar_to_captchac
function cf7bs_captchar_to_captchac($tag)
{
$tag['type'] = 'captchac';
$tag['basetype'] = 'captchac';
$tag['options'] = array();
$size = cf7bs_get_form_property('size');
$image_size = 'large' == $size ? 'l' : ('small' == $size ? 's' : 'm');
$tag['options'][] = 'size:' . $image_size;
return $tag;
}
示例6: cf7bs_submit_shortcode_handler
function cf7bs_submit_shortcode_handler($tag)
{
$tag = new WPCF7_Shortcode($tag);
$class = wpcf7_form_controls_class($tag->type);
$value = isset($tag->values[0]) ? $tag->values[0] : '';
if (empty($value)) {
$value = __('Send', 'contact-form-7');
}
$size = cf7bs_get_form_property('submit_size');
if (!$size) {
$size = cf7bs_get_form_property('size');
}
$button = new CF7BS_Button(array('mode' => 'submit', 'id' => $tag->get_option('id', 'id', true), 'class' => $tag->get_class_option($class), 'title' => $value, 'type' => cf7bs_get_form_property('submit_type'), 'size' => $size, 'tabindex' => $tag->get_option('tabindex', 'int', true), 'align' => $tag->get_option('align', '[A-Za-z]+', true), 'grid_columns' => cf7bs_get_form_property('grid_columns'), 'form_layout' => cf7bs_get_form_property('layout'), 'form_label_width' => cf7bs_get_form_property('label_width'), 'form_breakpoint' => cf7bs_get_form_property('breakpoint')));
$html = $button->display(false);
return $html;
}
示例7: cf7bs_acceptance_shortcode_handler
function cf7bs_acceptance_shortcode_handler($tag)
{
$tag = new WPCF7_Shortcode($tag);
if (empty($tag->name)) {
return '';
}
$mode = $status = 'default';
$validation_error = wpcf7_get_validation_error($tag->name);
$class = wpcf7_form_controls_class($tag->type);
if ($validation_error) {
$class .= ' wpcf7-not-valid';
$status = 'error';
}
if ($tag->has_option('invert')) {
$class .= ' wpcf7-invert';
}
$field = new CF7BS_Form_Field(cf7bs_apply_field_args_filter(array('name' => $tag->name, 'id' => $tag->get_option('id', 'id', true), 'class' => $tag->get_class_option($class), 'type' => 'checkbox', 'value' => $tag->has_option('default:on') ? '1' : '0', 'options' => array('1' => $tag->content), 'help_text' => $validation_error, 'size' => cf7bs_get_form_property('size'), 'grid_columns' => cf7bs_get_form_property('grid_columns'), 'form_layout' => cf7bs_get_form_property('layout'), 'form_label_width' => cf7bs_get_form_property('label_width'), 'form_breakpoint' => cf7bs_get_form_property('breakpoint'), 'group_layout' => cf7bs_get_form_property('group_layout'), 'mode' => $mode, 'status' => $status, 'tabindex' => $tag->get_option('tabindex', 'int', true), 'wrapper_class' => $tag->name), $tag->basetype, $tag->name));
$html = $field->display(false);
return $html;
}
示例8: cf7bs_select_shortcode_handler
function cf7bs_select_shortcode_handler($tag)
{
$tag = new WPCF7_Shortcode($tag);
if (empty($tag->name)) {
return '';
}
$mode = $status = 'default';
$validation_error = wpcf7_get_validation_error($tag->name);
$class = wpcf7_form_controls_class($tag->type);
if ($validation_error) {
$class .= ' wpcf7-not-valid';
$status = 'error';
}
if ($tag->is_required()) {
$mode = 'required';
}
$defaults = array();
$default_choice = $tag->get_default_option(null, 'multiple=1');
foreach ($default_choice as $value) {
$key = array_search($value, $values, true);
if (false !== $key) {
$defaults[] = (int) $key + 1;
}
}
if ($matches = $tag->get_first_match_option('/^default:([0-9_]+)$/')) {
$defaults = explode('_', $matches[1]);
}
$defaults = array_unique($defaults);
$multiple = $tag->has_option('multiple');
$include_blank = $tag->has_option('include_blank');
$first_as_label = $tag->has_option('first_as_label');
$values = $tag->values;
$labels = $tag->labels;
if ($data = (array) $tag->get_data_option()) {
$values = array_merge($values, array_values($data));
$labels = array_merge($labels, array_values($data));
}
$empty_select = empty($values);
$shifted = false;
if ($empty_select || $include_blank) {
array_unshift($labels, '---');
array_unshift($values, '');
$shifted = true;
} elseif ($first_as_label) {
$values[0] = '';
}
$options = array();
$selected = '';
if ($multiple) {
$selected = array();
}
if (isset($_POST[$tag->name])) {
$post = $_POST[$tag->name];
} else {
if (isset($_GET[$tag->name])) {
if ($multiple) {
$get = cf7bs_array_decode(rawurldecode($_GET[$tag->name]));
} else {
$get = rawurldecode($_GET[$tag->name]);
}
}
$post = $multiple ? array() : '';
}
$posted = wpcf7_is_posted();
foreach ($values as $key => $value) {
$options[$value] = isset($labels[$key]) ? $labels[$key] : $value;
if ($posted && !empty($post)) {
if ($multiple && in_array(esc_sql($value), (array) $post)) {
$selected[] = $value;
}
if (!$multiple && $post == esc_sql($value)) {
$selected = $value;
}
} elseif (isset($get) && !empty($get)) {
if ($multiple && in_array(esc_sql($value), (array) $get)) {
$selected[] = $value;
}
if (!$multiple && $get == esc_sql($value)) {
$selected = $value;
}
} elseif (!$shifted && in_array((int) $key + 1, (array) $defaults) || $shifted && in_array((int) $key, (array) $defaults)) {
if ($multiple) {
$selected[] = $value;
} else {
$selected = $value;
}
}
}
$field = new CF7BS_Form_Field(cf7bs_apply_field_args_filter(array('name' => $tag->name, 'id' => $tag->get_option('id', 'id', true), 'class' => $tag->get_class_option($class), 'type' => $multiple ? 'multiselect' : 'select', 'value' => $selected, 'label' => $tag->content, 'options' => $options, 'help_text' => $validation_error, 'size' => cf7bs_get_form_property('size'), 'grid_columns' => cf7bs_get_form_property('grid_columns'), 'form_layout' => cf7bs_get_form_property('layout'), 'form_label_width' => cf7bs_get_form_property('label_width'), 'form_breakpoint' => cf7bs_get_form_property('breakpoint'), 'mode' => $mode, 'status' => $status, 'tabindex' => $tag->get_option('tabindex', 'int', true), 'wrapper_class' => $tag->name), $tag->basetype, $tag->name));
$html = $field->display(false);
return $html;
}
示例9: cf7bs_text_shortcode_handler
function cf7bs_text_shortcode_handler($tag)
{
$tag_obj = new WPCF7_Shortcode($tag);
if (empty($tag_obj->name)) {
return '';
}
$mode = $status = 'default';
$validation_error = wpcf7_get_validation_error($tag_obj->name);
$class = wpcf7_form_controls_class($tag_obj->type, 'wpcf7-text');
if (in_array($tag_obj->basetype, array('email', 'url', 'tel'))) {
$class .= ' wpcf7-validates-as-' . $tag_obj->basetype;
}
if ($validation_error) {
$class .= ' wpcf7-not-valid';
$status = 'error';
}
// size is not used since Bootstrap input fields always scale 100%
//$atts['size'] = $tag_obj->get_size_option( '40' );
if ($tag_obj->is_required()) {
$mode = 'required';
}
$value = (string) reset($tag_obj->values);
$placeholder = '';
if ($tag_obj->has_option('placeholder') || $tag_obj->has_option('watermark')) {
$placeholder = $value;
$value = '';
}
$value = $tag_obj->get_default_option($value);
if (wpcf7_is_posted() && isset($_POST[$tag_obj->name])) {
$value = stripslashes_deep($_POST[$tag_obj->name]);
} elseif (isset($_GET) && array_key_exists($tag_obj->name, $_GET)) {
$value = stripslashes_deep(rawurldecode($_GET[$tag_obj->name]));
}
$input_before = $tag_obj->get_first_match_option('/input_before:([^\\s]+)/');
$input_after = $tag_obj->get_first_match_option('/input_after:([^\\s]+)/');
if (is_array($input_before) && isset($input_before[1])) {
$input_before = str_replace('---', ' ', $input_before[1]);
} else {
$input_before = '';
}
if (is_array($input_after) && isset($input_after[1])) {
$input_after = str_replace('---', ' ', $input_after[1]);
} else {
$input_after = '';
}
if ($tag_obj->has_option('include_count')) {
$count_mode = 'input_after';
$count_down = false;
$count_options = $tag_obj->get_option('include_count', '[A-Za-z]+(:[A-Za-z]+)?', true);
if ($count_options) {
$count_options = explode(':', $count_options);
foreach ($count_options as $count_option) {
switch ($count_option) {
case 'down':
case 'DOWN':
$count_down = true;
break;
case 'before':
case 'BEFORE':
$count_mode = 'input_before';
break;
default:
}
}
}
$tag = cf7bs_text_to_count($tag, $count_down);
if (!empty(${$count_mode})) {
${$count_mode} = wpcf7_count_shortcode_handler($tag) . ' ' . ${$count_mode};
} else {
${$count_mode} = wpcf7_count_shortcode_handler($tag);
}
}
$field = new CF7BS_Form_Field(cf7bs_apply_field_args_filter(array('name' => $tag_obj->name, 'id' => $tag_obj->get_option('id', 'id', true), 'class' => $tag_obj->get_class_option($class), 'type' => wpcf7_support_html5() ? $tag_obj->basetype : 'text', 'value' => $value, 'placeholder' => $placeholder, 'label' => $tag_obj->content, 'help_text' => $validation_error, 'size' => cf7bs_get_form_property('size'), 'grid_columns' => cf7bs_get_form_property('grid_columns'), 'form_layout' => cf7bs_get_form_property('layout'), 'form_label_width' => cf7bs_get_form_property('label_width'), 'form_breakpoint' => cf7bs_get_form_property('breakpoint'), 'mode' => $mode, 'status' => $status, 'readonly' => $tag_obj->has_option('readonly') ? true : false, 'minlength' => $tag_obj->get_minlength_option(), 'maxlength' => $tag_obj->get_maxlength_option(), 'tabindex' => $tag_obj->get_option('tabindex', 'int', true), 'wrapper_class' => $tag_obj->name, 'input_before' => $input_before, 'input_after' => $input_after), $tag_obj->basetype, $tag_obj->name));
$html = $field->display(false);
return $html;
}
示例10: display
public function display($echo = true)
{
$output = apply_filters('cf7bs_bootstrap_form_field_display', '', $this->args);
if (empty($output)) {
$output = '';
extract($this->args);
$type = $this->validate_type($type);
$value = $this->validate_value($value, $type, $options);
if ('hidden' != $type) {
$label_class = 'control-label';
$input_div_class = '';
$input_class = $class;
if ('horizontal' == $form_layout) {
$classes = $this->get_column_width_classes($form_label_width, $form_breakpoint, $grid_columns);
$label_class .= ' ' . $classes['label'];
$input_div_class = $classes['input'];
if (empty($label)) {
$input_div_class .= ' ' . $this->get_column_offset_class($form_label_width, $form_breakpoint, $grid_columns);
}
} elseif ('inline' == $form_layout) {
if (empty($placeholder)) {
$placeholder = $label;
}
}
if (!empty($wrapper_class)) {
$wrapper_class = ' ' . esc_attr($wrapper_class);
}
if (!in_array($type, array('radio', 'checkbox'))) {
if (!empty($input_class)) {
$input_class .= ' ';
}
if (!in_array($type, array('file', 'range'))) {
$input_class .= 'form-control';
}
if ('textarea' != $type) {
if ('large' == $size) {
$input_class .= ' input-lg';
} elseif (in_array($size, array('small', 'mini'))) {
$input_class .= ' input-sm';
}
}
if (is_int($tabindex)) {
$tabindex = ' tabindex="' . $tabindex . '"';
} else {
$tabindex = '';
}
}
if (!empty($input_class)) {
$input_class = ' class="' . esc_attr($input_class) . '"';
}
if (!empty($placeholder)) {
$placeholder = ' placeholder="' . esc_attr($placeholder) . '"';
}
if ($readonly) {
$readonly = ' readonly';
} else {
$readonly = '';
}
if ($minlength && $minlength > 0) {
$minlength = ' minlength="' . absint($minlength) . '"';
} else {
$minlength = '';
}
if ($maxlength && $maxlength > -1) {
$maxlength = ' maxlength="' . absint($maxlength) . '"';
} else {
$maxlength = '';
}
$append = '';
if (in_array($status, array('success', 'warning', 'error'))) {
$status = ' has-' . $status;
} else {
$status = '';
}
if ('has-error' == $status) {
$append .= ' aria-invalid="true"';
} else {
$append .= ' aria-invalid="false"';
}
$label_required = '';
if ('required' == $mode) {
$append .= ' aria-required="true" required';
$label_required = ' ' . cf7bs_get_form_property('required_html');
} elseif ('disabled' == $mode) {
$append .= ' disabled';
}
if ('horizontal' == $form_layout) {
$output .= '<div class="form-group' . $wrapper_class . $status . '">';
if (!empty($label)) {
$output .= '<label class="' . esc_attr($label_class) . '"' . (!empty($id) ? ' for="' . esc_attr($id) . '"' : '') . '>' . esc_html($label) . $label_required . '</label>';
}
$output .= '<div class="' . esc_attr($input_div_class) . '">';
} elseif ('inline' == $form_layout) {
$output .= '<div class="form-group' . $wrapper_class . $status . '">';
if (!empty($label)) {
$output .= '<label class="sr-only"' . (!empty($id) ? ' for="' . esc_attr($id) . '"' : '') . '>' . esc_html($label) . $label_required . '</label>';
}
} else {
$output .= '<div class="form-group' . $wrapper_class . $status . '">';
if (!empty($label)) {
//.........这里部分代码省略.........
示例11: cf7bs_checkbox_shortcode_handler
//.........这里部分代码省略.........
$status = 'error';
}
$exclusive = $tag->has_option('exclusive');
$free_text = $tag->has_option('free_text');
$multiple = false;
if ('checkbox' == $tag->basetype) {
$multiple = !$exclusive;
} else {
$exclusive = false;
}
if ($exclusive) {
$class .= ' wpcf7-exclusive-checkbox';
}
if ($tag->is_required()) {
$mode = 'required';
}
$values = (array) $tag->values;
$labels = (array) $tag->labels;
if ($data = (array) $tag->get_data_option()) {
if ($free_text) {
$values = array_merge(array_slice($values, 0, -1), array_values($data), array_slice($values, -1));
$labels = array_merge(array_slice($labels, 0, -1), array_values($data), array_slice($labels, -1));
} else {
$values = array_merge($values, array_values($data));
$labels = array_merge($labels, array_values($data));
}
}
$defaults = array();
$default_choice = $tag->get_default_option(null, 'multiple=1');
foreach ($default_choice as $value) {
$key = array_search($value, $values, true);
if (false !== $key) {
$defaults[] = (int) $key + 1;
}
}
if ($matches = $tag->get_first_match_option('/^default:([0-9_]+)$/')) {
$defaults = array_merge($defaults, explode('_', $matches[1]));
}
$defaults = array_unique($defaults);
$options = array();
$checked = '';
if ($multiple) {
$checked = array();
}
if (isset($_POST[$tag->name])) {
$post = $_POST[$tag->name];
} else {
if (isset($_GET[$tag->name])) {
if ($multiple) {
$get = cf7bs_array_decode(rawurldecode($_GET[$tag->name]));
} else {
$get = rawurldecode($_GET[$tag->name]);
}
}
$post = $multiple ? array() : '';
}
$posted = wpcf7_is_posted();
$count = 0;
foreach ((array) $tag->values as $key => $value) {
if ($free_text && $count == count($tag->values) - 1) {
$options[$value] = '<input type="text" name="' . sprintf('_wpcf7_%1$s_free_text_%2$s', $tag->basetype, $tag->name) . '" class="wpcf7-free-text">';
} else {
$options[$value] = isset($labels[$key]) ? $labels[$key] : $value;
}
if ($posted && !empty($post)) {
if ($multiple && in_array(esc_sql($value), (array) $post)) {
$checked[] = $value;
}
if (!$multiple && $post == esc_sql($value)) {
$checked = $value;
}
} elseif (isset($get) && !empty($get)) {
if ($multiple && in_array(esc_sql($value), (array) $get)) {
$checked[] = $value;
}
if (!$multiple && $get == esc_sql($value)) {
$checked = $value;
}
} elseif (in_array($key + 1, (array) $defaults)) {
if ($multiple) {
$checked[] = $value;
} else {
$checked = $value;
}
}
$count++;
}
$label = $tag->content;
if (count($options) < 1) {
if ($free_text) {
$options = array('true' => '<input type="text" name="' . sprintf('_wpcf7_%1$s_free_text_%2$s', $tag->basetype, $tag->name) . '" class="wpcf7-free-text">');
} else {
$options = array('true' => $label);
$label = '';
}
}
$field = new CF7BS_Form_Field(cf7bs_apply_field_args_filter(array('name' => $tag->name, 'id' => $tag->get_option('id', 'id', true), 'class' => '', 'type' => $tag->basetype, 'value' => $checked, 'label' => $label, 'options' => $options, 'help_text' => $validation_error, 'size' => cf7bs_get_form_property('size'), 'grid_columns' => cf7bs_get_form_property('grid_columns'), 'form_layout' => cf7bs_get_form_property('layout'), 'form_label_width' => cf7bs_get_form_property('label_width'), 'form_breakpoint' => cf7bs_get_form_property('breakpoint'), 'group_layout' => cf7bs_get_form_property('group_layout'), 'group_type' => cf7bs_get_form_property('group_type'), 'mode' => $mode, 'status' => $status, 'tabindex' => $tag->get_option('tabindex', 'int', true), 'wrapper_class' => $tag->get_class_option($class . ' ' . $tag->name)), $tag->basetype, $tag->name));
$html = $field->display(false);
return $html;
}
示例12: cf7bs_form_class_attr
function cf7bs_form_class_attr($class = '')
{
$layout = cf7bs_get_form_property('layout');
if (in_array($layout, array('horizontal', 'inline'))) {
if (!empty($class)) {
$class .= ' ';
}
$class .= 'form-' . $layout;
}
return $class;
}
示例13: cf7bs_quiz_shortcode_handler
function cf7bs_quiz_shortcode_handler($tag)
{
$tag = new WPCF7_Shortcode($tag);
if (empty($tag->name)) {
return '';
}
$status = 'default';
$validation_error = wpcf7_get_validation_error($tag->name);
$class = wpcf7_form_controls_class($tag->type);
if ($validation_error) {
$class .= ' wpcf7-not-valid';
$status = 'error';
}
// size is not used since Bootstrap input fields always scale 100%
//$atts['size'] = $tag->get_size_option( '40' );
$pipes = $tag->pipes;
if (is_a($pipes, 'WPCF7_Pipes') && !$pipes->zero()) {
$pipe = $pipes->random_pipe();
$question = $pipe->before;
$answer = $pipe->after;
} else {
// default quiz
$question = '1+1=?';
$answer = '2';
}
$answer = wpcf7_canonicalize($answer);
$field = new CF7BS_Form_Field(cf7bs_apply_field_args_filter(array('name' => $tag->name, 'id' => $tag->get_option('id', 'id', true), 'class' => $tag->get_class_option($class), 'type' => 'text', 'value' => '', 'placeholder' => '', 'label' => $tag->content, 'help_text' => $validation_error, 'size' => cf7bs_get_form_property('size'), 'grid_columns' => cf7bs_get_form_property('grid_columns'), 'form_layout' => cf7bs_get_form_property('layout'), 'form_label_width' => cf7bs_get_form_property('label_width'), 'form_breakpoint' => cf7bs_get_form_property('breakpoint'), 'status' => $status, 'maxlength' => $tag->get_maxlength_option(), 'tabindex' => $tag->get_option('tabindex', 'int', true), 'wrapper_class' => $tag->name), $tag->basetype, $tag->name));
$html = $field->display(false);
$hidden_html = sprintf('<input type="hidden" name="_wpcf7_quiz_answer_%1$s" value="%2$s">', $tag->name, wp_hash($answer, 'wpcf7_quiz'));
return str_replace('<input', '<p class="wpcf7-quiz-label">' . esc_html($question) . '</p>' . $hidden_html . '<input', $html);
}