Automattic\WooCommerce\Internal\Admin\ProductForm

Field::__construct()publicWC 1.0

Constructor

Метод класса: Field{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$Field = new Field();
$Field->__construct( $id, $plugin_id, $additional_args );
$id(строка) (обязательный)
Field id.
$plugin_id(строка) (обязательный)
Plugin id.
$additional_args(массив) (обязательный)
Array containing the necessary arguments.
php $args = array( 'type' => (string) Field type. Required. 'section' => (string) Field location. Required. 'order' => (int) Field order. 'properties' => (array) Field properties. ).

Код Field::__construct() WC 9.1.2

public function __construct( $id, $plugin_id, $additional_args ) {
	parent::__construct( $id, $plugin_id, $additional_args );
	$this->required_arguments = array(
		'type',
		'section',
		'properties.name',
		'properties.label',
	);

	$missing_arguments = self::get_missing_arguments( $additional_args );
	if ( count( $missing_arguments ) > 0 ) {
		throw new \Exception(
			sprintf(
			/* translators: 1: Missing arguments list. */
				esc_html__( 'You are missing required arguments of WooCommerce ProductForm Field: %1$s', 'woocommerce' ),
				join( ', ', $missing_arguments )
			)
		);
	}
}