PHP Class Fieldmanager_Colorpicker, vip-mu-plugins-public

Provides an interface to navigate colors and submits the 6-character hex code e.g. #ffffff. This field uses the {@link https://make.wordpress.org/core/2012/11/30/new-color-picker-in-wp-3-5/ WordPress core color picker introduced in WordPress 3.5}.
Inheritance: extends Fieldmanager_Field
Mostrar archivo Open project: Automattic/vip-mu-plugins-public Class Usage Examples

Public Properties

Property Type Description
$field_class string Override field_class.
$has_registered_statics boolean Static variable so we only load static assets once.

Public Methods

Method Description
__construct ( string $label = '', array $options = [] ) Build the colorpicker object and enqueue assets.
form_element ( mixed $value = '' ) : string Form element.
sanitize_hex_color ( string $color ) : string Sanitizes a hex color.

Method Details

__construct() public method

Build the colorpicker object and enqueue assets.
public __construct ( string $label = '', array $options = [] )
$label string
$options array

form_element() public method

Form element.
public form_element ( mixed $value = '' ) : string
$value mixed
return string HTML

sanitize_hex_color() public method

Returns either '', a 3 or 6 digit hex color (with #), or nothing. This was copied from core; sanitize_hex_color() is not available outside of the customizer. {@see https://core.trac.wordpress.org/ticket/27583}.
public sanitize_hex_color ( string $color ) : string
$color string
return string

Property Details

$field_class public_oe property

Override field_class.
public string $field_class
return string

$has_registered_statics public_oe static_oe property

Static variable so we only load static assets once.
public static bool $has_registered_statics
return boolean