WordPress at a glance
function is not described

WP_Widget::get_field_name() public WP 2.8.0

Constructs name attributes for use in form() fields

This function should be used in form() methods to create name attributes for fields to be saved by update()

{} It's a method of the class: WP_Widget{}

No Hooks.

Return

String. Name attribute for $field_name

Usage

$WP_Widget = new WP_Widget();
$WP_Widget->get_field_name( $field_name );
$field_name(string) (required)
Field name

Changelog

Since 2.8.0 Introduced.
Since 4.4.0 Array format field names are now accepted.

Code of WP_Widget::get_field_name() WP 5.7.2

<?php
public function get_field_name( $field_name ) {
	$pos = strpos( $field_name, '[' );
	if ( false === $pos ) {
		return 'widget-' . $this->id_base . '[' . $this->number . '][' . $field_name . ']';
	} else {
		return 'widget-' . $this->id_base . '[' . $this->number . '][' . substr_replace( $field_name, '][', $pos, strlen( '[' ) );
	}
}