/**
  * We overwrite the field attribute to add our hidden fields, as this
  * formfield can contain multiple values.
  *
  * @param array $properties
  * @return DBHTMLText
  */
 public function Field($properties = array())
 {
     $value = '';
     $titleArray = array();
     $idArray = array();
     $items = $this->getItems();
     $emptyTitle = _t('DropdownField.CHOOSE', '(Choose)', 'start value of a dropdown');
     if ($items && count($items)) {
         foreach ($items as $item) {
             $idArray[] = $item->ID;
             $titleArray[] = $item instanceof ViewableData ? $item->obj($this->labelField)->forTemplate() : Convert::raw2xml($item->{$this->labelField});
         }
         $title = implode(", ", $titleArray);
         $value = implode(",", $idArray);
     } else {
         $title = $emptyTitle;
     }
     $dataUrlTree = '';
     if ($this->form) {
         $dataUrlTree = $this->Link('tree');
         if (!empty($idArray)) {
             $dataUrlTree = Controller::join_links($dataUrlTree, '?forceValue=' . implode(',', $idArray));
         }
     }
     $properties = array_merge($properties, array('Title' => $title, 'EmptyTitle' => $emptyTitle, 'Link' => $dataUrlTree, 'Value' => $value));
     return FormField::Field($properties);
 }
 /**
  * @param array $properties
  * @return string
  */
 public function Field($properties = array())
 {
     $properties = array_merge($properties, array('MaxFileSize' => $this->getValidator()->getAllowedMaxFileSize()));
     return parent::Field($properties);
 }
 /**
  * Returns a <select> tag containing all the appropriate <option> tags
  *
  * @param array $properties
  * @return string
  */
 public function Field($properties = array())
 {
     $properties = array_merge($properties, array('Options' => $this->getOptions()));
     return FormField::Field($properties);
 }
 /**
  * @param array $properties
  * @return string
  */
 public function Field($properties = array())
 {
     $item = DataObject::singleton($this->sourceObject);
     $emptyTitle = _t('DropdownField.CHOOSE_MODEL', '(Choose {name})', ['name' => $item->i18n_singular_name()]);
     $record = $this->Value() ? $this->objectForKey($this->Value()) : null;
     if ($record instanceof ViewableData) {
         $title = $record->obj($this->labelField)->forTemplate();
     } elseif ($record) {
         $title = Convert::raw2xml($record->{$this->labelField});
     } else {
         $title = $emptyTitle;
     }
     // TODO Implement for TreeMultiSelectField
     $metadata = array('id' => $record ? $record->ID : null, 'ClassName' => $record ? $record->ClassName : $this->sourceObject);
     $properties = array_merge($properties, array('Title' => $title, 'EmptyTitle' => $emptyTitle, 'Metadata' => $metadata ? Convert::raw2json($metadata) : null));
     return parent::Field($properties);
 }
 public function Field($properties = array())
 {
     $options = array();
     $odd = false;
     // Add all options striped
     foreach ($this->getSourceEmpty() as $value => $title) {
         $odd = !$odd;
         $options[] = $this->getFieldOption($value, $title, $odd);
     }
     $properties = array_merge($properties, array('Options' => new ArrayList($options)));
     return FormField::Field($properties);
 }
 /**
  * @param array $properties
  * @return DBHTMLText
  */
 public function Field($properties = array())
 {
     $properties = array_merge($properties, array('Name' => $this->action, 'Title' => $this->description && !$this->useButtonTag ? $this->description : $this->Title(), 'UseButtonTag' => $this->useButtonTag));
     return parent::Field($properties);
 }
 /**
  * @param array $properties
  * @return string
  */
 public function Field($properties = array())
 {
     return parent::Field($properties);
 }