mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Merge branch '3.4' into 3
This commit is contained in:
commit
3906228fc1
@ -147,7 +147,7 @@ you will get an instance of [api:HasManyList] rather than the object.
|
|||||||
echo $player->FirstName;
|
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
|
||||||
<?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
|
Multiple `$has_one` relationships are okay if they aren't linking to the same object type. Otherwise, they have to be
|
||||||
named.
|
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
|
## belongs_to
|
||||||
|
|
||||||
Defines a 1-to-1 relationship with another object, which declares the other end of the relationship with a
|
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
|
`$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`.
|
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.
|
This is not mandatory unless the relationship would be otherwise ambiguous.
|
||||||
|
|
||||||
:::php
|
:::php
|
||||||
|
@ -54,9 +54,7 @@ class CheckboxSetField extends OptionsetField {
|
|||||||
'Options' => $this->getOptions()
|
'Options' => $this->getOptions()
|
||||||
));
|
));
|
||||||
|
|
||||||
return $this->customise($properties)->renderWith(
|
return FormField::Field($properties);
|
||||||
$this->getTemplates()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -102,7 +102,7 @@ class ListboxField extends DropdownField {
|
|||||||
'Options' => new ArrayList($options)
|
'Options' => new ArrayList($options)
|
||||||
));
|
));
|
||||||
|
|
||||||
return $this->customise($properties)->renderWith($this->getTemplates());
|
return FormField::Field($properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAttributes() {
|
public function getAttributes() {
|
||||||
|
@ -83,9 +83,7 @@ class OptionsetField extends DropdownField {
|
|||||||
'Options' => new ArrayList($options)
|
'Options' => new ArrayList($options)
|
||||||
));
|
));
|
||||||
|
|
||||||
return $this->customise($properties)->renderWith(
|
return FormField::Field($properties);
|
||||||
$this->getTemplates()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -248,7 +248,7 @@ class TreeDropdownField extends FormField {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->customise($properties)->renderWith('TreeDropdownField');
|
return parent::Field($properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function extraClass() {
|
public function extraClass() {
|
||||||
|
@ -135,7 +135,7 @@ class TreeMultiselectField extends TreeDropdownField {
|
|||||||
'Value' => $value
|
'Value' => $value
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
return $this->customise($properties)->renderWith('TreeDropdownField');
|
return FormField::Field($properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -974,11 +974,11 @@ class UploadField extends FileField {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$mergedConfig = array_merge($config, $this->ufConfig);
|
$mergedConfig = array_merge($config, $this->ufConfig);
|
||||||
return $this->customise(array(
|
return parent::Field(array(
|
||||||
'configString' => str_replace('"', """, Convert::raw2json($mergedConfig)),
|
'configString' => str_replace('"', """, Convert::raw2json($mergedConfig)),
|
||||||
'config' => new ArrayData($mergedConfig),
|
'config' => new ArrayData($mergedConfig),
|
||||||
'multiple' => $allowedMaxFileNumber !== 1
|
'multiple' => $allowedMaxFileNumber !== 1
|
||||||
))->renderWith($this->getTemplates());
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user