You are here

protected function ExcelExport::validateRgbValue in Excel Serialization 8

Validates the header background color field of the display.

Parameters

string $rgb_value: The rgb value to validate.

Return value

array A list of error strings.

1 call to ExcelExport::validateRgbValue()
ExcelExport::validateOptionsForm in src/Plugin/views/display/ExcelExport.php
Validate the options form.

File

src/Plugin/views/display/ExcelExport.php, line 338

Class

ExcelExport
Provides an Excel export display plugin.

Namespace

Drupal\xls_serialization\Plugin\views\display

Code

protected function validateRgbValue($rgb_value) {
  $errors = [];
  if ($rgb_value !== '' && !preg_match('/^([a-f0-9]{6})$/iD', strtolower($rgb_value))) {
    $errors[] = $this
      ->t('Background color must be a 6-digit hexadecimal value.');
  }
  return $errors;
}