public function __construct($name, $title = null, $value = "")
 {
     $this->config = $this->config()->default_config;
     $this->timeField = TimeField::create($name . '[time]', false);
     $this->dateField = DateField::create($name . '[date]', false);
     $this->timezoneField = new HiddenField($name . '[timezone]');
     parent::__construct($name, $title, $value);
 }
 public function scaffoldFormField($title = null, $params = null)
 {
     $field = DateField::create($this->name, $title);
     // Show formatting hints for better usability
     $field->setDescription(sprintf(_t('FormField.Example', 'e.g. %s', 'Example format'), Convert::raw2xml(Zend_Date::now()->toString($field->getConfig('dateformat')))));
     $field->setAttribute('placeholder', $field->getConfig('dateformat'));
     return $field;
 }
 /**
  * Get the search context from {@link File}, used to create the search form
  * as well as power the /search API endpoint.
  *
  * @return SearchContext
  */
 public function getSearchContext()
 {
     $context = File::singleton()->getDefaultSearchContext();
     // Customize fields
     $dateHeader = HeaderField::create('Date', _t('CMSSearch.FILTERDATEHEADING', 'Date'), 4);
     $dateFrom = DateField::create('CreatedFrom', _t('CMSSearch.FILTERDATEFROM', 'From'))->setConfig('showcalendar', true);
     $dateTo = DateField::create('CreatedTo', _t('CMSSearch.FILTERDATETO', 'To'))->setConfig('showcalendar', true);
     $dateGroup = FieldGroup::create($dateHeader, $dateFrom, $dateTo);
     $context->addField($dateGroup);
     /** @skipUpgrade */
     $appCategories = array('archive' => _t('SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.AppCategoryArchive', 'Archive'), 'audio' => _t('SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.AppCategoryAudio', 'Audio'), 'document' => _t('SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.AppCategoryDocument', 'Document'), 'flash' => _t('SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.AppCategoryFlash', 'Flash', 'The fileformat'), 'image' => _t('SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.AppCategoryImage', 'Image'), 'video' => _t('SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.AppCategoryVideo', 'Video'));
     $context->addField($typeDropdown = new DropdownField('AppCategory', _t('SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.Filetype', 'File type'), $appCategories));
     $typeDropdown->setEmptyString(' ');
     $currentfolderLabel = _t('SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.CurrentFolderOnly', 'Limit to current folder?');
     $context->addField(new CheckboxField('CurrentFolderOnly', $currentfolderLabel));
     $context->getFields()->removeByName('Title');
     return $context;
 }