label. * - descriptions (optional): array of value => short text shown under the label of that chip. */ class TPTDisplayType { const FIELD_TYPE = 'tpt_display_type'; public function __construct() { add_action( 'woocommerce_admin_field_' . self::FIELD_TYPE, array( $this, 'render' ) ); } public function render( $value ) { $extendedDescription = (string) ( $value['extended_description'] ?? '' ); $value = wp_parse_args( $value, array( 'id' => '', 'title' => isset( $value['name'] ) ? $value['name'] : '', 'default' => '', 'desc' => '', 'options' => array(), 'descriptions' => array(), 'class' => '', ) ); if ( ! isset( $value['value'] ) ) { $value['value'] = \WC_Admin_Settings::get_option( $value['id'], $value['default'] ); } $optionValue = $value['value']; $descriptions = is_array( $value['descriptions'] ) ? $value['descriptions'] : array(); $hasDesc = ! empty( array_filter( $descriptions ) ); ?>