public function PdfTemplate::parseColor in Views PDF 7
Same name and namespace in other branches
- 6 views_pdf_template.php \PdfTemplate::parseColor()
- 7.3 views_pdf_template.php \PdfTemplate::parseColor()
- 7.2 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()
File
- ./
views_pdf_template.php, line 259 - 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;
}
}