| @@ -9,19 +9,20 @@ | ||
| 9 | 9 | class FrmFieldDefault extends FrmFieldType { |
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | 12 | * @var bool |
| 13 | + * | |
| 13 | 14 | * @since 3.0 |
| 14 | 15 | */ |
| 15 | 16 | protected $holds_email_values = true; |
| 16 | 17 | |
| 17 | 18 | /** |
| 18 | - * @param $type string | |
| 19 | + * @param string $type | |
| 19 | 20 | * |
| 20 | 21 | * @return void |
| 21 | 22 | */ |
| 22 | 23 | protected function set_type( $type ) { |
| 23 | - if ( empty( $type ) ) { | |
| 24 | + if ( ! $type ) { | |
| 24 | 25 | $type = 'text'; |
| 25 | 26 | } |
| 26 | 27 | parent::set_type( $type ); |
| 27 | 28 | } |
| @@ -26,8 +27,10 @@ | ||
| 26 | 27 | parent::set_type( $type ); |
| 27 | 28 | } |
| 28 | 29 | |
| 29 | 30 | /** |
| 31 | + * @param string $name | |
| 32 | + * | |
| 30 | 33 | * @return void |
| 31 | 34 | */ |
| 32 | 35 | public function show_on_form_builder( $name = '' ) { |
| 33 | 36 | $field = FrmFieldsHelper::setup_edit_vars( $this->field ); |
| @@ -34,20 +37,22 @@ | ||
| 34 | 37 | |
| 35 | 38 | ob_start(); |
| 36 | 39 | do_action( 'frm_display_added_fields', $field ); |
| 37 | 40 | do_action( 'frm_display_added_' . $this->type . '_field', $field ); |
| 38 | - $input_html = ob_get_contents(); | |
| 39 | - ob_end_clean(); | |
| 41 | + $input_html = ob_get_clean(); | |
| 40 | 42 | |
| 41 | - if ( empty( $input_html ) ) { | |
| 43 | + if ( $input_html ) { | |
| 44 | + echo $input_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 45 | + } else { | |
| 42 | 46 | echo $this->builder_text_field( $name ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 43 | - } else { | |
| 44 | - echo $input_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 45 | 47 | } |
| 46 | 48 | } |
| 47 | 49 | |
| 48 | 50 | /** |
| 49 | - * @return false|string | |
| 51 | + * @param array $args | |
| 52 | + * @param array $shortcode_atts | |
| 53 | + * | |
| 54 | + * @return string | |
| 50 | 55 | */ |
| 51 | 56 | public function front_field_input( $args, $shortcode_atts ) { |
| 52 | 57 | $pass_args = array( |
| 53 | 58 | 'errors' => $args['errors'], |
| @@ -55,10 +60,9 @@ | ||
| 55 | 60 | ); |
| 56 | 61 | ob_start(); |
| 57 | 62 | do_action( 'frm_form_fields', $this->field, $args['field_name'], $pass_args ); |
| 58 | 63 | do_action( 'frm_form_field_' . $this->type, $this->field, $args['field_name'], $pass_args ); |
| 59 | - $input_html = ob_get_contents(); | |
| 60 | - ob_end_clean(); | |
| 64 | + $input_html = ob_get_clean(); | |
| 61 | 65 | |
| 62 | - return $input_html; | |
| 66 | + return is_string( $input_html ) ? $input_html : ''; | |
| 63 | 67 | } |
| 64 | 68 | } |