From 93f809d6f129aa10091b21de6ba5fb9a0c66228f Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Thu, 4 Aug 2022 10:31:26 +1200 Subject: [PATCH] Add (pixels) to available label & pdf layout units --- CRM/Core/BAO/LabelFormat.php | 9 ++------- CRM/Core/BAO/PdfFormat.php | 9 ++------- CRM/Core/SelectValues.php | 16 ++++++++++++++++ 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/CRM/Core/BAO/LabelFormat.php b/CRM/Core/BAO/LabelFormat.php index 8678560c9c..4d8e462dab 100644 --- a/CRM/Core/BAO/LabelFormat.php +++ b/CRM/Core/BAO/LabelFormat.php @@ -203,13 +203,8 @@ class CRM_Core_BAO_LabelFormat extends CRM_Core_DAO_OptionValue { * @return array * array of measurement units */ - public static function getUnits() { - return [ - 'in' => ts('Inches'), - 'cm' => ts('Centimeters'), - 'mm' => ts('Millimeters'), - 'pt' => ts('Points'), - ]; + public static function getUnits(): array { + return CRM_Core_SelectValues::getLayoutUnits(); } /** diff --git a/CRM/Core/BAO/PdfFormat.php b/CRM/Core/BAO/PdfFormat.php index a082ace7af..cfe2ebfb01 100644 --- a/CRM/Core/BAO/PdfFormat.php +++ b/CRM/Core/BAO/PdfFormat.php @@ -113,13 +113,8 @@ class CRM_Core_BAO_PdfFormat extends CRM_Core_DAO_OptionValue { * @return array * array of measurement units */ - public static function getUnits() { - return [ - 'in' => ts('Inches'), - 'cm' => ts('Centimeters'), - 'mm' => ts('Millimeters'), - 'pt' => ts('Points'), - ]; + public static function getUnits(): array { + return CRM_Core_SelectValues::getLayoutUnits(); } /** diff --git a/CRM/Core/SelectValues.php b/CRM/Core/SelectValues.php index 2943c62f1c..e5a837f934 100644 --- a/CRM/Core/SelectValues.php +++ b/CRM/Core/SelectValues.php @@ -769,6 +769,22 @@ class CRM_Core_SelectValues { ]; } + /** + * Get measurement units recognized by the TCPDF package used to create PDF labels. + * + * @return array + * array of measurement units + */ + public static function getLayoutUnits(): array { + return [ + 'in' => ts('Inches'), + 'cm' => ts('Centimeters'), + 'mm' => ts('Millimeters'), + 'pt' => ts('Points'), + 'px' => ts('Pixels'), + ]; + } + /** * Extension types. * -- 2.25.1