/**
  * Create a new file field.
  *
  * @param string $name The internal field name, passed to forms.
  * @param string $title The field label.
  * @param SS_List $items Items assigned to this field
  */
 public function __construct($name, $title = null, SS_List $items = null)
 {
     $this->constructFileUploadReceiver();
     parent::__construct($name, $title);
     if ($items) {
         $this->setItems($items);
     }
 }
 public function __construct($name, $title = null, $value = "")
 {
     $this->setName($name);
     // naming with underscores to prevent values from actually being saved somewhere
     $this->fieldAmount = new NumericField("{$name}[Amount]", _t('MoneyField.FIELDLABELAMOUNT', 'Amount'));
     $this->fieldCurrency = $this->buildCurrencyField();
     parent::__construct($name, $title, $value);
 }
 /**
  * @param string $name The field name
  * @param string $title The field title
  * @param array|ArrayAccess $source A map of the dropdown items
  * @param mixed $value The current value
  */
 public function __construct($name, $title = null, $source = array(), $value = null)
 {
     $this->setSource($source);
     if (!isset($title)) {
         $title = $name;
     }
     parent::__construct($name, $title, $value);
 }
 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);
 }
 /**
  * Returns an input field.
  *
  * @param string $name
  * @param null|string $title
  * @param string $value
  * @param null|int $maxLength
  * @param null|Form $form
  */
 public function __construct($name, $title = null, $value = '', $maxLength = null, $form = null)
 {
     if ($maxLength) {
         $this->setMaxLength($maxLength);
     }
     if ($form) {
         $this->setForm($form);
     }
     parent::__construct($name, $title, $value);
 }
 public function __construct($children = null)
 {
     if ($children instanceof FieldList) {
         $this->children = $children;
     } elseif (is_array($children)) {
         $this->children = new FieldList($children);
     } else {
         //filter out null/empty items
         $children = array_filter(func_get_args());
         $this->children = new FieldList($children);
     }
     $this->children->setContainerField($this);
     parent::__construct(null, false);
 }
 /**
  * @param String $name
  * @param String $title
  * @param String $managedClass
  * @param String $filterField
  * @param Group|SS_List $records One or more {@link Group} or {@link PermissionRole} records
  *  used to determine permission checkboxes.
  *  Caution: saveInto() can only be used with a single record, all inherited permissions will be marked readonly.
  *  Setting multiple groups only makes sense in a readonly context. (Optional)
  */
 public function __construct($name, $title, $managedClass, $filterField, $records = null)
 {
     $this->filterField = $filterField;
     $this->managedClass = $managedClass;
     if ($records instanceof SS_List) {
         $this->records = $records;
     } elseif ($records instanceof Group) {
         $this->records = new ArrayList(array($records));
     } elseif ($records) {
         throw new InvalidArgumentException('$record should be either a Group record, or a SS_List of Group records');
     }
     // Get all available codes in the system as a categorized nested array
     $this->source = Permission::get_codes(true);
     parent::__construct($name, $title);
 }
 /**
  * Create a new file field.
  *
  * @param string $name The internal field name, passed to forms.
  * @param string $title The field label.
  * @param int $value The value of the field.
  */
 public function __construct($name, $title = null, $value = null)
 {
     $this->upload = Upload::create();
     parent::__construct($name, $title, $value);
 }
 /**
  * @param string $name
  * @param string $title
  * @param mixed $value
  * @param Form $form
  * @param boolean $showOnClick
  * @param string $titleConfirmField Alternate title (not localizeable)
  */
 public function __construct($name, $title = null, $value = "", $form = null, $showOnClick = false, $titleConfirmField = null)
 {
     // Set field title
     $title = isset($title) ? $title : _t('Member.PASSWORD', 'Password');
     // naming with underscores to prevent values from actually being saved somewhere
     $this->children = new FieldList($this->passwordField = new PasswordField("{$name}[_Password]", $title), $this->confirmPasswordfield = new PasswordField("{$name}[_ConfirmPassword]", isset($titleConfirmField) ? $titleConfirmField : _t('Member.CONFIRMPASSWORD', 'Confirm Password')));
     // has to be called in constructor because Field() isn't triggered upon saving the instance
     if ($showOnClick) {
         $this->children->push($this->hiddenField = new HiddenField("{$name}[_PasswordFieldVisible]"));
     }
     // disable auto complete
     foreach ($this->children as $child) {
         /** @var FormField $child */
         $child->setAttribute('autocomplete', 'off');
     }
     $this->showOnClick = $showOnClick;
     parent::__construct($name, $title);
     $this->setValue($value);
 }
 /**
  * CAVEAT: for search to work properly $labelField must be a database field,
  * or you need to setSearchFunction.
  *
  * @param string $name the field name
  * @param string $title the field label
  * @param string|array $sourceObject The object-type to list in the tree. This could
  * be one of the following:
  * - A DataObject class name with the {@link Hierarchy} extension.
  * - An array of key/value pairs, like a {@link DropdownField} source. In
  *   this case, the field will act like show a flat list of tree items,
  *	 without any hierarchy. This is most useful in conjunction with
  *   {@link TreeMultiselectField}, for presenting a set of checkboxes in
  *   a compact view. Note, that all value strings must be XML encoded
  *   safely prior to being passed in.
  *
  * @param string $keyField to field on the source class to save as the
  *		field value (default ID).
  * @param string $labelField the field name to show as the human-readable
  *		value on the tree (default Title).
  * @param bool $showSearch enable the ability to search the tree by
  *		entering the text in the input field.
  */
 public function __construct($name, $title = null, $sourceObject = 'SilverStripe\\Security\\Group', $keyField = 'ID', $labelField = 'TreeTitle', $showSearch = true)
 {
     $this->sourceObject = $sourceObject;
     $this->keyField = $keyField;
     $this->labelField = $labelField;
     $this->showSearch = $showSearch;
     //Extra settings for Folders
     if ($sourceObject == 'SilverStripe\\Assets\\Folder') {
         $this->childrenMethod = 'ChildFolders';
         $this->numChildrenMethod = 'numChildFolders';
     }
     $this->addExtraClass('single');
     parent::__construct($name, $title);
 }
 /**
  * @param string $name
  * @param string $title
  * @param SS_List $dataList
  * @param GridFieldConfig $config
  */
 public function __construct($name, $title = null, SS_List $dataList = null, GridFieldConfig $config = null)
 {
     parent::__construct($name, $title, null);
     $this->name = $name;
     if ($dataList) {
         $this->setList($dataList);
     }
     if (!$config) {
         $config = GridFieldConfig_Base::create();
     }
     $this->setConfig($config);
     $state = $this->config->getComponentByType('SilverStripe\\Forms\\GridField\\GridState_Component');
     if (!$state) {
         $this->config->addComponent(new GridState_Component());
     }
     $this->state = new GridState($this);
     $this->addExtraClass('grid-field');
 }
 /**
  * Create a new action button.
  *
  * @param string $action The method to call when the button is clicked
  * @param string $title The label on the button
  * @param string $extraClass A CSS class to apply to the button in addition to 'action'
  */
 public function __construct($action, $title = "", $extraClass = '')
 {
     $this->extraClass = ' ' . $extraClass;
     parent::__construct($action, $title);
 }
 /**
  * Create a new action button.
  *
  * @param string $action The method to call when the button is clicked
  * @param string $title The label on the button. This should be plain text, not escaped as HTML.
  * @param Form form The parent form, auto-set when the field is placed inside a form
  */
 public function __construct($action, $title = "", $form = null)
 {
     $this->action = "action_{$action}";
     $this->setForm($form);
     parent::__construct($this->action, $title);
 }