/** * Set a strainer as date from to * * @param null $callable * @param array $attr * @return $this */ public function setStrainerDateRange($callable = null, $attr = []) { // if callable is a string , it's a field if (is_string($callable) || $callable instanceof Expression) { $field = $callable; $callable = null; } // create the strainer $strainer = new DateRange($this, $callable, $attr); //if a fields is set, we configure the strainer if (isset($field)) { $strainer->setField($field); } return $this->setStrainer($strainer); }
/** * Render a striner for a text element * * @param Column\Strainer\Text $strainer * @return string */ public function strainerDateRange(Column\Strainer\DateRange $strainer) { $element = $strainer->getElement(); $html = html('input', ['type' => 'text', 'class' => Style::FORM_ELEMENT_CONTROL, 'name' => $element->getFrom()]); $html .= '<span class="input-group-addon">-</span>'; $html .= html('input', ['type' => 'text', 'class' => Style::FORM_ELEMENT_CONTROL, 'name' => $element->getTo()]); return html('div', ['name' => $element->getName(), 'class' => 'input-group date-picker daterange input-daterange text-center', 'data-date-format' => configurator()->get('form.element.date.formatjs')], $html); }