element. * * @param string $name Field name. * @param array $options value => label. * @param mixed $value Selected value. * @param string $id Optional id. */ public static function select( $name, $options, $value, $id = '' ) { echo ''; } /** * Table rows of colour settings: picker + "or variable" field. * * @param string $option Option name (fields are option[key] and option[key_var]). * @param array $colors key => default hex. * @param array $labels key => label. * @param array $values Saved settings. */ public static function color_rows( $option, $colors, $labels, $values ) { foreach ( $colors as $key => $default_hex ) : ?>
' . esc_html__( 'Pick a color, or type a CSS variable name such as --fs-color-primary to follow your theme colors. When a variable is set it is used, and the picked color becomes the fallback.', 'cpod-kit' ) . '

'; } /** * CSS value of a colour: var(--name, #hex) when a variable is set, otherwise the hex colour. * * @param array $values Settings. * @param string $key Colour key. * @return string */ public static function css_color( $values, $key ) { $hex = isset( $values[ $key ] ) ? $values[ $key ] : ''; $var = isset( $values[ $key . '_var' ] ) ? $values[ $key . '_var' ] : ''; return $var ? 'var(' . $var . ', ' . $hex . ')' : $hex; } /** Capability used to save the plugin's settings screens (shop managers included). */ public static function capability() { return 'manage_woocommerce'; } /** * Register an option group saved through options.php by shop managers. * * @param string $group Option group. * @param string $option Option name. * @param callable $sanitize Sanitize callback. */ public static function register( $group, $option, $sanitize ) { register_setting( $group, $option, array( 'type' => 'array', 'sanitize_callback' => $sanitize, ) ); add_filter( 'option_page_capability_' . $group, array( __CLASS__, 'capability' ) ); } }