$option, 'id' => 'validate_birthdate_adult', 'label' => __( 'Check if your store only allows over 18s.', 'age-restriction-18-for-checkout-fields' ), ) ); register_setting( $option, $option, array( $this, 'validate_options' ) ); } public function validate_birthdate_adult_field_render() { $options = get_option('age_restriction_settings'); if(isset($options) && !empty($options) && isset($options['validate_birthdate_adult']) && $options['validate_birthdate_adult']=='on'): echo ''; echo '
Esse plugin é um complemento do plugin WooCommerce Extra Checkout Fields for Brazil e só funcionará com ele instalado.
'; else: echo ''; endif; } public function age_restriction_18_for_checkout_fields_settings_section_callback( ) { // echo __( 'This section description', 'wp-my-account' ); } /** * Options page callback */ public function create_admin_page() { include plugin_dir_path(__FILE__) .'../views/html-admin-page.php'; } /** * Valid options. * * @param array $input options to valid. * * @return array validated options. */ public function validate_options( $input ) { $output = array(); // Loop through each of the incoming options. foreach ( $input as $key => $value ) { // Check to see if the current option has a value. If so, process it. if ( isset( $input[ $key ] ) ) { $output[ $key ] = sanitize_text_field( $input[ $key ] ); } } return $output; } } if( is_admin() ) $RegisterAdminPages = new RegisterAdminPages();