Merge in 5.16
[civicrm-core.git] / CRM / Core / SelectValues.php
index 7acab2d906be7ac27417d2d573e25a1a2f8013d0..65f7eb86bd6e7caaa24ecf96d464a6ddab0a87ae 100644 (file)
@@ -730,7 +730,7 @@ class CRM_Core_SelectValues {
    * @return array
    */
   public static function getDatePluginInputFormats() {
-    $dateInputFormats = [
+    return [
       "mm/dd/yy" => ts('mm/dd/yyyy (12/31/2009)'),
       "dd/mm/yy" => ts('dd/mm/yyyy (31/12/2009)'),
       "yy-mm-dd" => ts('yyyy-mm-dd (2009-12-31)'),
@@ -747,21 +747,6 @@ class CRM_Core_SelectValues {
       'M yy' => ts('M yyyy (Dec 2009)'),
       "yy" => ts('yyyy (2009)'),
     ];
-
-    /*
-    Year greater than 2000 get wrong result for following format
-    echo date( 'Y-m-d', strtotime( '7 Nov, 2001') );
-    echo date( 'Y-m-d', strtotime( '7 November, 2001') );
-    Return current year
-    expected :: 2001-11-07
-    output   :: 2009-11-07
-    However
-    echo date( 'Y-m-d', strtotime( 'Nov 7, 2001') );
-    echo date( 'Y-m-d', strtotime( 'November 7, 2001') );
-    gives proper result
-     */
-
-    return $dateInputFormats;
   }
 
   /**
@@ -1160,4 +1145,21 @@ class CRM_Core_SelectValues {
     return $options;
   }
 
+  /**
+   * Get components (translated for display.
+   *
+   * @return array
+   *
+   * @throws \Exception
+   */
+  public static function getComponentSelectValues() {
+    $ret = [];
+    $components = CRM_Core_Component::getComponents();
+    foreach ($components as $name => $object) {
+      $ret[$name] = $object->info['translatedName'];
+    }
+
+    return $ret;
+  }
+
 }