Example #1
0
 /**
  * {@inheritDoc}
  */
 public function render(ElementInterface $element)
 {
     if (!$element instanceof DateSelectElement) {
         throw new Exception\InvalidArgumentException(sprintf('%s requires that the element is of type %s', __METHOD__, DateSelectElement::class));
     }
     $elementAttribs = $element->getAttributes();
     unset($elementAttribs['name']);
     $id = $this->getId($element);
     $attribs = $element->getYearAttributes();
     $element->setYearAttributes(array_replace_recursive($elementAttribs, empty($attribs['id']) ? ['id' => (empty($elementAttribs['id']) ? $id : $elementAttribs['id']) . '-year'] : [], $attribs));
     $attribs = $element->getMonthAttributes();
     $element->setMonthAttributes(array_replace_recursive($elementAttribs, empty($attribs['id']) ? ['id' => (empty($elementAttribs['id']) ? $id : $elementAttribs['id']) . '-month'] : [], $attribs));
     $attribs = $element->getDayAttributes();
     $element->setDayAttributes(array_replace_recursive($elementAttribs, empty($attribs['id']) ? ['id' => (empty($elementAttribs['id']) ? $id : $elementAttribs['id']) . '-day'] : [], $attribs));
     return parent::render($element);
 }
 /**
  * @throws Exception\ExtensionNotLoadedException if ext/intl is not present
  */
 public function __construct()
 {
     parent::__construct();
     // Delaying initialization until we know ext/intl is available
     $this->timeType = IntlDateFormatter::LONG;
 }
Example #3
0
 /**
  * {@inheritDoc}
  */
 protected function getYearsOptions($minYear, $maxYear)
 {
     $result = parent::getYearsOptions($minYear, $maxYear);
     //$result = array('' => __('Year')) + $result;
     return $result;
 }