Merge branch '3.4' into 3

This commit is contained in:
Daniel Hensby 2016-07-11 21:14:21 +01:00
commit 3906228fc1
No known key found for this signature in database
GPG Key ID: 229831A941962E26
7 changed files with 20 additions and 14 deletions

View File

@ -147,7 +147,7 @@ you will get an instance of [api:HasManyList] rather than the object.
echo $player->FirstName;
}
To specify multiple $has_manys to the same object you can use dot notation to distinguish them like below:
To specify multiple `$has_many` to the same object you can use dot notation to distinguish them like below:
:::php
<?php
@ -172,15 +172,25 @@ To specify multiple $has_manys to the same object you can use dot notation to di
Multiple `$has_one` relationships are okay if they aren't linking to the same object type. Otherwise, they have to be
named.
If you're using the default scaffolded form fields with multiple `has_one` relationships, you will end up with a CMS field for each relation. If you don't want these you can remove them by their IDs:
:::php
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->removeByName(array('ManagerID', 'CleanerID'));
return $fields;
}
## belongs_to
Defines a 1-to-1 relationship with another object, which declares the other end of the relationship with a
corresponding $has_one. A single database column named `<relationship-name>ID` will be created in the object with the
corresponding `$has_one`. A single database column named `<relationship-name>ID` will be created in the object with the
`$has_one`, but the $belongs_to by itself will not create a database field. This field will hold the ID of the object
declaring the `$belongs_to`.
Similarly with $has_many, dot notation can be used to explicitly specify the `$has_one` which refers to this relation.
Similarly with `$has_many`, dot notation can be used to explicitly specify the `$has_one` which refers to this relation.
This is not mandatory unless the relationship would be otherwise ambiguous.
:::php

View File

@ -54,9 +54,7 @@ class CheckboxSetField extends OptionsetField {
'Options' => $this->getOptions()
));
return $this->customise($properties)->renderWith(
$this->getTemplates()
);
return FormField::Field($properties);
}
/**

View File

@ -102,7 +102,7 @@ class ListboxField extends DropdownField {
'Options' => new ArrayList($options)
));
return $this->customise($properties)->renderWith($this->getTemplates());
return FormField::Field($properties);
}
public function getAttributes() {

View File

@ -83,9 +83,7 @@ class OptionsetField extends DropdownField {
'Options' => new ArrayList($options)
));
return $this->customise($properties)->renderWith(
$this->getTemplates()
);
return FormField::Field($properties);
}
/**

View File

@ -248,7 +248,7 @@ class TreeDropdownField extends FormField {
)
);
return $this->customise($properties)->renderWith('TreeDropdownField');
return parent::Field($properties);
}
public function extraClass() {

View File

@ -135,7 +135,7 @@ class TreeMultiselectField extends TreeDropdownField {
'Value' => $value
)
);
return $this->customise($properties)->renderWith('TreeDropdownField');
return FormField::Field($properties);
}
/**

View File

@ -974,11 +974,11 @@ class UploadField extends FileField {
}
$mergedConfig = array_merge($config, $this->ufConfig);
return $this->customise(array(
return parent::Field(array(
'configString' => str_replace('"', "&quot;", Convert::raw2json($mergedConfig)),
'config' => new ArrayData($mergedConfig),
'multiple' => $allowedMaxFileNumber !== 1
))->renderWith($this->getTemplates());
));
}
/**