CRM-13422 - Consolidate extra rules for contact reminders
[civicrm-core.git] / CRM / Core / BAO / ActionSchedule.php
index 14783381a67c54e5646a83ee8e868f1746ae123e..780da240d8fe1c38d2f931164bfa8ad11e76415e 100755 (executable)
@@ -67,6 +67,15 @@ class CRM_Core_BAO_ActionSchedule extends CRM_Core_DAO_ActionSchedule {
     }
   }
 
+  /**
+   * @param string|int $id
+   * @return \Civi\ActionSchedule\Mapping|NULL
+   */
+  public static function getMapping($id) {
+    $mappings = self::getMappings();
+    return isset($mappings[$id]) ? $mappings[$id] : NULL;
+  }
+
   /**
    * Retrieve list of selections/drop downs for Scheduled Reminder form
    *
@@ -84,11 +93,8 @@ class CRM_Core_BAO_ActionSchedule extends CRM_Core_DAO_ActionSchedule {
     foreach ($mappings as $mapping) {
       /** @var \Civi\ActionSchedule\Mapping $mapping */
       $entityValueLabels[$mapping->getId()] = $mapping->getValueLabels();
-      // Not sure why: everything *except* contact-dates have a $valueLabel.
-      if ($mapping->getId() !== CRM_Contact_ActionMapping::CONTACT_MAPPING_ID) {
-        $valueLabel = array('- ' . strtolower($mapping->getValueHeader()) . ' -');
-        $entityValueLabels[$mapping->getId()] = $valueLabel + $entityValueLabels[$mapping->getId()];
-      }
+      $valueLabel = array('- ' . strtolower($mapping->getValueHeader()) . ' -');
+      $entityValueLabels[$mapping->getId()] = $valueLabel + $entityValueLabels[$mapping->getId()];
     }
 
     $entityStatusLabels = array();