get_description(); $html .= ''; $html .= sprintf( '
%2$s
    ', esc_attr( $this->name ), // field name, used in HTML attributes esc_html( $this->get_dropdown_label() ), // form switcher label esc_html__( 'Search users', 'gravityforms' ), // label for search field esc_attr( $this->get_value() ) ); // If field failed validation, add error icon. $html .= $this->get_error_icon(); $html .= '
    '; return $html; } /** * Get the label for the dropdown. * * @since 2.9.5 * * @return string */ public function get_dropdown_label() { if ( empty( $this->get_value() ) ) { return __( 'Select a user', 'gravityforms' ); } if ( 'logged-in-user' === $this->get_value() ) { return __( 'Logged In User', 'gravityforms' ); } $user_id = $this->get_value(); $user = get_user_by( 'id', $user_id ); return esc_attr( $user->display_name ); } } Fields::register( 'user_select', '\Gravity_Forms\Gravity_Forms\Settings\Fields\User_Select' );