Automattic\WooCommerce\Internal\Admin\Settings
SettingsUISchema::is_supported_form_post_name
Whether a field name can be serialized by the form-post adapter.
Method of the class: SettingsUISchema{}
No Hooks.
Returns
bool.
Usage
$result = SettingsUISchema::is_supported_form_post_name( $name, $is_array ): bool;
- $name(mixed) (required)
- Candidate field name.
- $is_array(true|false) (required)
- Whether the field posts a string list.
SettingsUISchema::is_supported_form_post_name() SettingsUISchema::is supported form post name code WC 11.2.1
private static function is_supported_form_post_name( $name, bool $is_array ): bool {
if ( ! is_string( $name ) || '' === $name ) {
return false;
}
$base_name = $is_array && '[]' === substr( $name, -2 ) ? substr( $name, 0, -2 ) : $name;
return 1 === preg_match( '/^[^\[\]]+(?:\[[^\[\]]+\])?$/', $base_name );
}