Automattic\WooCommerce\Internal\Admin\ProductForm
FormFactory::add_field()
Adds a field to the product form.
Method of the class: FormFactory{}
No Hooks.
Return
Field|WP_Error
. New field or WP_Error.
Usage
$result = FormFactory::add_field( $id, $plugin_id, $args );
- $id(string) (required)
- Field id.
- $plugin_id(string) (required)
- Plugin id.
- $args(array) (required)
- 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. 'name' => (string) Field name. ).
FormFactory::add_field() FormFactory::add field code WC 7.7.0
public static function add_field( $id, $plugin_id, $args ) { $new_field = self::create_item( 'field', 'Field', $id, $plugin_id, $args ); if ( is_wp_error( $new_field ) ) { return $new_field; } self::$form_fields[ $id ] = $new_field; return $new_field; }