You are here

class HexColorConstraint in Color API 8

Ensures that values are valid hexadecimal color strings.

Plugin annotation


@Constraint(
  id = "HexadecimalColor",
  label = @Translation("Hexadecimal Color", context = "Validation"),
  type = "hexadecimal_color"
)

Hierarchy

  • class \Drupal\colorapi\Plugin\Validation\Constraint\HexColorConstraint extends \Symfony\Component\Validator\Constraint

Expanded class hierarchy of HexColorConstraint

File

src/Plugin/Validation/Constraint/HexColorConstraint.php, line 16

Namespace

Drupal\colorapi\Plugin\Validation\Constraint
View source
class HexColorConstraint extends Constraint {

  /**
   * The message shown when the value is not a valid hexadecimal color string.
   *
   * @var string
   */
  public $notValidHexadecimalColorString = '%value is not a valid hexadecimal color string. Hexadecimal color strings are in the format #XXXXXX where X is a hexadecimal character (0-9, a-f).';

}

Members

Namesort descending Modifiers Type Description Overrides
HexColorConstraint::$notValidHexadecimalColorString public property The message shown when the value is not a valid hexadecimal color string.