c05605fddf
* Update husky from 4 to 7 * Update @types/jest from 26 to 27 * Update lint-staged from 10 to 12 * Update babel-jest from 26 to 27 * Update @typescript-eslint/eslint-plugin from 4 to 5 * Update @typescript-eslint/parser from 4 to 5 * Update chalk from 4 to 5 * Update concurrently from 5 to 7 * Update stylelint from 9 to 14 and stylelint-config-wordpress from 13 to 17 * Update @wordpress/prettier-config from 0.4 to 1.1 * Update eslint from 7 to 8, @wordpress/eslint-plugin from 8 to 10, eslint-plugin-testing-library to 5 * Fix lint errors after updating eslint-plugin-testing-library * Fix style lint * Rename .stylelintrc.json -> stylelint.config.js & add todo comment Fix stylelint.config.js * Remove @wordpress/e2e-test-utils * Add changelogs for eslint-plugin * Update storybook/preview.js since addDecorator has been deprecated Remove parameters * Import directly from @storybook/addon-docs * Migrate some stories to use @storybook/addon-controls Add a comment for @storybook/addon-knobs * Update changelogs * Update preview.js to fix lint warning * Update pnpm-lock.yaml * Fix eslint layout errors (https://github.com/woocommerce/woocommerce-admin/pull/8484) |
||
---|---|---|
.. | ||
historical-data | ||
README.md | ||
config.js | ||
default-date.js | ||
index.js | ||
index.scss | ||
setting.js | ||
setting.scss |
README.md
Settings
The settings used to modify the way data is retreived or displayed in WooCommerce reports.
Extending Settings
Settings can be added, removed, or modified outside oc wc-admin
by hooking into woocommerce_admin_analytics_settings
. For example:
addFilter( 'woocommerce_admin_analytics_settings', 'wc-example/my-setting', settings => {
return [
...settings,
{
name: 'custom_setting',
label: __( 'Custom setting:', 'woocommerce-admin' ),
inputType: 'text',
helpText: __( 'Help text to describe what the setting does.' ),
defaultValue: 'Default value',
},
];
} );
Each settings has the following properties:
name
(string): The slug of the setting to be updated.label
(string): The label used to describe and displayed next to the setting.inputType
(enum: text|checkbox|checkboxGroup): The type of input to use.helpText
(string): Text displayed beneath the setting.options
(array): Array of options used for inputs with selectable options.defaultValue
(string|array): Value used when resetting to default settings.