Automattic\WooCommerce\Admin\Features\Settings
Transformer::handle_group_end()
Handle the end of a group.
Method of the class: Transformer{}
No Hooks.
Return
null
. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->handle_group_end( $setting, $transformed_settings ): void;
- $setting(array) (required)
- Setting to add.
- $transformed_settings(array) (required)
- Transformed settings array.
Transformer::handle_group_end() Transformer::handle group end code WC 9.7.1
private function handle_group_end( array $setting, array &$transformed_settings ): void { $ids_match = $this->current_group && isset( $this->current_group[0]['id'] ) && isset( $setting['id'] ) && $this->current_group[0]['id'] === $setting['id']; $ids_match_undefined = $this->current_group && ! isset( $this->current_group[0]['id'] ) && ! isset( $setting['id'] ); // If IDs match, add the group and close it. if ( $ids_match || $ids_match_undefined ) { // Compose the group setting. $title_setting = array_shift( $this->current_group ); $transformed_settings[] = array_merge( $title_setting, array( 'type' => 'group', 'settings' => $this->current_group, ) ); $this->current_group = null; return; } // If IDs don't match, we don't need to transform anything so flush the current group. $this->flush_current_group( $transformed_settings ); $this->add_setting( $setting, $transformed_settings ); }