You are here

public function PdfTemplate::parseColor in Views PDF 7.2

Same name and namespace in other branches
  1. 6 views_pdf_template.php \PdfTemplate::parseColor()
  2. 7.3 views_pdf_template.php \PdfTemplate::parseColor()
  3. 7 views_pdf_template.php \PdfTemplate::parseColor()

Parse color input into an array.

Parameters

string $color Color entered by the user:

Return value

array color as an array

1 call to PdfTemplate::parseColor()
PdfTemplate::renderRow in ./views_pdf_template.php

File

./views_pdf_template.php, line 201
PDF Class to generate PDFs with native PHP. This class based on FPDF and FPDI.

Class

PdfTemplate
The main class to generate the 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;
  }
}