Component.php
2 years ago
ComponentTrait.php
3 years ago
Field.php
3 years ago
FormFactory.php
3 years ago
Section.php
3 years ago
Subsection.php
3 years ago
Tab.php
3 years ago
Section.php
43 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Handles product form section related methods. |
| 4 | */ |
| 5 | |
| 6 | namespace Automattic\WooCommerce\Internal\Admin\ProductForm; |
| 7 | |
| 8 | /** |
| 9 | * Section class. |
| 10 | */ |
| 11 | class Section extends Component { |
| 12 | |
| 13 | /** |
| 14 | * Constructor |
| 15 | * |
| 16 | * @param string $id Section id. |
| 17 | * @param string $plugin_id Plugin id. |
| 18 | * @param array $additional_args Array containing additional arguments. |
| 19 | * $args = array( |
| 20 | * 'order' => (int) Section order. |
| 21 | * 'title' => (string) Section description. |
| 22 | * 'description' => (string) Section description. |
| 23 | * ). |
| 24 | * @throws \Exception If there are missing arguments. |
| 25 | */ |
| 26 | public function __construct( $id, $plugin_id, $additional_args ) { |
| 27 | parent::__construct( $id, $plugin_id, $additional_args ); |
| 28 | $this->required_arguments = array( |
| 29 | 'title', |
| 30 | ); |
| 31 | $missing_arguments = self::get_missing_arguments( $additional_args ); |
| 32 | if ( count( $missing_arguments ) > 0 ) { |
| 33 | throw new \Exception( |
| 34 | sprintf( |
| 35 | /* translators: 1: Missing arguments list. */ |
| 36 | esc_html__( 'You are missing required arguments of WooCommerce ProductForm Section: %1$s', 'woocommerce' ), |
| 37 | join( ', ', $missing_arguments ) |
| 38 | ) |
| 39 | ); |
| 40 | } |
| 41 | } |
| 42 | } |
| 43 |