public function Field($properties = array())
 {
     $config = array('timeformat' => $this->getConfig('timeformat'));
     $config = array_filter($config);
     $this->addExtraClass(Convert::raw2json($config));
     return parent::Field($properties);
 }
 public function Field($properties = array())
 {
     $config = array('showcalendar' => $this->getConfig('showcalendar'), 'isoDateformat' => $this->getConfig('dateformat'), 'jquerydateformat' => DateField_View_JQuery::convert_iso_to_jquery_format($this->getConfig('dateformat')), 'min' => $this->getConfig('min'), 'max' => $this->getConfig('max'));
     // Add other jQuery UI specific, namespaced options (only serializable, no callbacks etc.)
     // TODO Move to DateField_View_jQuery once we have a properly extensible HTML5 attribute system for FormField
     $jqueryUIConfig = array();
     foreach ($this->getConfig() as $k => $v) {
         if (preg_match('/^jQueryUI\\.(.*)/', $k, $matches)) {
             $jqueryUIConfig[$matches[1]] = $v;
         }
     }
     if ($jqueryUIConfig) {
         $config['jqueryuiconfig'] = Convert::array2json(array_filter($jqueryUIConfig));
     }
     $config = array_filter($config);
     foreach ($config as $k => $v) {
         $this->setAttribute('data-' . $k, $v);
     }
     // Three separate fields for day, month and year
     if ($this->getConfig('dmyfields')) {
         // values
         $valArr = $this->valueObj ? $this->valueObj->toArray() : null;
         // fields
         $fieldNames = Zend_Locale::getTranslationList('Field', $this->locale);
         $fieldDay = NumericField::create($this->name . '[day]', false, $valArr ? $valArr['day'] : null)->addExtraClass('day')->setAttribute('placeholder', $this->getConfig('dmyplaceholders') ? $fieldNames['day'] : null)->setMaxLength(2);
         $fieldMonth = NumericField::create($this->name . '[month]', false, $valArr ? $valArr['month'] : null)->addExtraClass('month')->setAttribute('placeholder', $this->getConfig('dmyplaceholders') ? $fieldNames['month'] : null)->setMaxLength(2);
         $fieldYear = NumericField::create($this->name . '[year]', false, $valArr ? $valArr['year'] : null)->addExtraClass('year')->setAttribute('placeholder', $this->getConfig('dmyplaceholders') ? $fieldNames['year'] : null)->setMaxLength(4);
         // order fields depending on format
         $sep = $this->getConfig('dmyseparator');
         $format = $this->getConfig('dateformat');
         $fields = array();
         $fields[stripos($format, 'd')] = $fieldDay->Field();
         $fields[stripos($format, 'm')] = $fieldMonth->Field();
         $fields[stripos($format, 'y')] = $fieldYear->Field();
         ksort($fields);
         $html = implode($sep, $fields);
         // dmyfields doesn't work with showcalendar
         $this->setConfig('showcalendar', false);
     } else {
         $html = parent::Field();
     }
     return $html;
 }