/** * build the date range - relative or absolute * * @param CRM_Core_Form $form * The form object that we are operating on. * @param string $fieldName * @param array $selector * Array of option values to add. * @param string $from * Label. * @param string|\stringe $to * @param string $fromLabel * @param bool $required * @param string $dateFormat * @param bool $displayTime */ public static function addDateRangeToForm(&$form, $fieldName, $selector, $from = '_from', $to = '_to', $fromLabel = 'From:', $required = FALSE, $dateFormat = 'searchDate', $displayTime = FALSE) { $form->add('select', "{$fieldName}_relative", ts('Relative Date Range'), $selector, $required, array('class' => 'crm-select2')); $form->addDateRange($fieldName, $from, $to, $fromLabel, $dateFormat, FALSE, $displayTime); }