Add (pixels) to available label & pdf layout units
authorEileen McNaughton <emcnaughton@wikimedia.org>
Wed, 3 Aug 2022 22:31:26 +0000 (10:31 +1200)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Wed, 3 Aug 2022 22:31:57 +0000 (10:31 +1200)
CRM/Core/BAO/LabelFormat.php
CRM/Core/BAO/PdfFormat.php
CRM/Core/SelectValues.php

index 8678560c9cf30a693035e0d4ea34b5872fda3168..4d8e462dabad5c20a50ad9460e9498aa26bacd56 100644 (file)
@@ -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();
   }
 
   /**
index a082ace7afe12a9547b18291373154070c1bf1f2..cfe2ebfb0116d7cbe1209e4ccc8fc0c7798832dc 100644 (file)
@@ -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();
   }
 
   /**
index 2943c62f1ceb974d7e7fa17fc550f199811b390e..e5a837f9340075bc13d84a998ebddf5ce9800ea3 100644 (file)
@@ -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.
    *