You are here

interface JQueryColorpickerServiceInterface in Jquery Colorpicker 8

Interface for jQuery Colorpicker service.

Hierarchy

Expanded class hierarchy of JQueryColorpickerServiceInterface

All classes that implement JQueryColorpickerServiceInterface

1 file declares its use of JQueryColorpickerServiceInterface
JQueryColorpickerDefaultWidget.php in src/Plugin/Field/FieldWidget/JQueryColorpickerDefaultWidget.php

File

src/Service/JQueryColorpickerServiceInterface.php, line 8

Namespace

Drupal\jquery_colorpicker\Service
View source
interface JQueryColorpickerServiceInterface {

  /**
   * Formats colors into a consistent format for database storage.
   *
   * Turns non-scalar values into an empty string. Removes the leading # (hash)
   * from the given value if one exists at the start of the string.
   *
   * @param mixed $color
   *   The value to be formatted.
   *
   * @return string
   *   The formatted string.
   */
  public function formatColor($color);

  /**
   * Validates a hecidecimal color string.
   *
   * The following rules are validated:
   *   - Length is six characters
   *   - Value is hexidecimal.
   *
   * @param string $color
   *   The color string to be validated.
   *
   * @return bool|\Drupal\Core\StringTranslation\TranslatableMarkup
   *   FALSE if there are no errors, or a TranslateabeMarkup object
   *   containing the error message if there are any errors.
   */
  public function validateColor($color);

}

Members

Namesort descending Modifiers Type Description Overrides
JQueryColorpickerServiceInterface::formatColor public function Formats colors into a consistent format for database storage. 1
JQueryColorpickerServiceInterface::validateColor public function Validates a hecidecimal color string. 1