| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
die( 'You are not allowed to call this page directly.' ); |
| 4 |
} |
| 5 |
|
| 6 |
/** |
| 7 |
* @since 3.0 |
| 8 |
*/ |
| 9 |
class FrmFieldDefault extends FrmFieldType { |
| 10 |
|
| 11 |
/** |
| 12 |
* @var bool |
| 13 |
* @since 3.0 |
| 14 |
*/ |
| 15 |
protected $holds_email_values = true; |
| 16 |
|
| 17 |
/** |
| 18 |
* @param $type string |
| 19 |
*/ |
| 20 |
protected function set_type( $type ) { |
| 21 |
if ( empty( $type ) ) { |
| 22 |
$type = 'text'; |
| 23 |
} |
| 24 |
parent::set_type( $type ); |
| 25 |
} |
| 26 |
|
| 27 |
public function show_on_form_builder( $name = '' ) { |
| 28 |
$field = FrmFieldsHelper::setup_edit_vars( $this->field ); |
| 29 |
|
| 30 |
ob_start(); |
| 31 |
do_action( 'frm_display_added_fields', $field ); |
| 32 |
do_action( 'frm_display_added_' . $this->type . '_field', $field ); |
| 33 |
$input_html = ob_get_contents(); |
| 34 |
ob_end_clean(); |
| 35 |
|
| 36 |
if ( empty( $input_html ) ) { |
| 37 |
echo $this->builder_text_field( $name ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 38 |
} else { |
| 39 |
echo $input_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 40 |
} |
| 41 |
} |
| 42 |
|
| 43 |
public function front_field_input( $args, $shortcode_atts ) { |
| 44 |
$pass_args = array( |
| 45 |
'errors' => $args['errors'], |
| 46 |
'html_id' => $args['html_id'], |
| 47 |
); |
| 48 |
ob_start(); |
| 49 |
do_action( 'frm_form_fields', $this->field, $args['field_name'], $pass_args ); |
| 50 |
do_action( 'frm_form_field_' . $this->type, $this->field, $args['field_name'], $pass_args ); |
| 51 |
$input_html = ob_get_contents(); |
| 52 |
ob_end_clean(); |
| 53 |
|
| 54 |
return $input_html; |
| 55 |
} |
| 56 |
} |
| 57 |
|