You are here

public function ViewsPdfBase::parseColor in Views PDF 8

Parse color input into an array.

Parameters

string $color Color entered by the user:

Return value

array color as an array

1 call to ViewsPdfBase::parseColor()
ViewsPdfBase::renderRow in src/ViewsPdfBase.php

File

src/ViewsPdfBase.php, line 303
Contains \Drupal\views_pdf\ViewsPdfTemplate.

Class

ViewsPdfBase
The main class to generate the PDF.

Namespace

Drupal\views_pdf

Code

public function parseColor($color) {
  $color = trim($color, ', ');
  $components = explode(',', $color);
  if (count($components) == 1) {
    return $this
      ->convertHexColorToArray($color);
  }
  else {

    // Remove white spaces from comonents:
    foreach ($components as $id => $component) {
      $components[$id] = trim($component);
    }
    return $components;
  }
}