/var/www/html_us/wp-content/plugins/woocommerce/src/Internal/Admin/ProductForm/Field.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/**
 * Handles product form field related methods.
 */

namespace Automattic\WooCommerce\Internal\Admin\ProductForm;

/**
 * Field class.
 */
class Field extends Component {

    
/**
     * Constructor
     *
     * @param string $id Field id.
     * @param string $plugin_id Plugin id.
     * @param array  $additional_args Array containing the necessary arguments.
     *     $args = array(
     *       'type'            => (string) Field type. Required.
     *       'section'         => (string) Field location. Required.
     *       'order'           => (int) Field order.
     *       'properties'      => (array) Field properties.
     *     ).
     * @throws \Exception If there are missing arguments.
     */
    
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 ) > ) {
            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 )
                )
            );
        }
    }
}