mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge branch '3.4' into 3
This commit is contained in:
commit
0a835c6fe7
@ -9,7 +9,6 @@ addons:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
- CORE_RELEASE=3
|
|
||||||
- "ARTIFACTS_AWS_REGION=us-east-1"
|
- "ARTIFACTS_AWS_REGION=us-east-1"
|
||||||
- "ARTIFACTS_S3_BUCKET=silverstripe-travis-artifacts"
|
- "ARTIFACTS_S3_BUCKET=silverstripe-travis-artifacts"
|
||||||
- secure: "DjwZKhY/c0wXppGmd8oEMiTV0ayfOXiCmi9Lg1aXoSXNnj+sjLmhYwhUWjehjR6IX0MRtzJG6v7V5Y+4nSGe+i+XIrBQnhPQ95Jrkm1gKofX2mznWTl9npQElNS1DXi58NLPbiB3qxHWGFBRAWmRQrsAouyZabkPnChnSa9ldOg="
|
- secure: "DjwZKhY/c0wXppGmd8oEMiTV0ayfOXiCmi9Lg1aXoSXNnj+sjLmhYwhUWjehjR6IX0MRtzJG6v7V5Y+4nSGe+i+XIrBQnhPQ95Jrkm1gKofX2mznWTl9npQElNS1DXi58NLPbiB3qxHWGFBRAWmRQrsAouyZabkPnChnSa9ldOg="
|
||||||
@ -33,6 +32,7 @@ matrix:
|
|||||||
env: DB=MYSQL BEHAT_TEST=1 CMS_TEST=1
|
env: DB=MYSQL BEHAT_TEST=1 CMS_TEST=1
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
|
- export CORE_RELEASE=$TRAVIS_BRANCH
|
||||||
- if ! [ $(phpenv version-name) = "5.3" ]; then printf "\n" | pecl install imagick; fi
|
- if ! [ $(phpenv version-name) = "5.3" ]; then printf "\n" | pecl install imagick; fi
|
||||||
- if [ $(phpenv version-name) = "5.3" ]; then printf "\n" | pecl install imagick-3.3.0; fi
|
- if [ $(phpenv version-name) = "5.3" ]; then printf "\n" | pecl install imagick-3.3.0; fi
|
||||||
- composer self-update || true
|
- composer self-update || true
|
||||||
|
@ -427,6 +427,16 @@ Given the following structure, it will output the text.
|
|||||||
Page 'Grandchild 1' is a grandchild of 'My Page'
|
Page 'Grandchild 1' is a grandchild of 'My Page'
|
||||||
Page 'Child 2' is a child of 'MyPage'
|
Page 'Child 2' is a child of 'MyPage'
|
||||||
|
|
||||||
|
<div class="notice" markdown="1">
|
||||||
|
Additional selectors implicitely change the scope so you need to put additional `$Up` to get what you expect.
|
||||||
|
</div>
|
||||||
|
|
||||||
|
:::ss
|
||||||
|
<h1>Children of '$Title'</h1>
|
||||||
|
<% loop $Children.Sort('Title').First %>
|
||||||
|
<%-- We have two additional selectors in the loop expression so... --%>
|
||||||
|
<p>Page '$Title' is a child of '$Up.Up.Up.Title'</p>
|
||||||
|
<% end_loop %>
|
||||||
|
|
||||||
#### Top
|
#### Top
|
||||||
|
|
||||||
@ -444,8 +454,6 @@ page. The previous example could be rewritten to use the following syntax.
|
|||||||
<% end_loop %>
|
<% end_loop %>
|
||||||
<% end_loop %>
|
<% end_loop %>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### With
|
### With
|
||||||
|
|
||||||
The `<% with %>` tag lets you change into a new scope. Consider the following example:
|
The `<% with %>` tag lets you change into a new scope. Consider the following example:
|
||||||
@ -466,7 +474,12 @@ Outside the `<% with %>.`, we are in the page scope. Inside it, we are in the sc
|
|||||||
refer directly to properties and methods of the [api:Member] object. `$FirstName` inside the scope is equivalent to
|
refer directly to properties and methods of the [api:Member] object. `$FirstName` inside the scope is equivalent to
|
||||||
`$CurrentMember.FirstName`.
|
`$CurrentMember.FirstName`.
|
||||||
|
|
||||||
|
### Me
|
||||||
|
|
||||||
|
`$Me` outputs the current object in scope. This will call the `forTemplate` of the object.
|
||||||
|
|
||||||
|
:::ss
|
||||||
|
$Me
|
||||||
|
|
||||||
## Comments
|
## Comments
|
||||||
|
|
||||||
|
@ -304,72 +304,7 @@ For example, imagine you're on the "bob marley" page, which is three levels in:
|
|||||||
|
|
||||||
## Navigating Scope
|
## Navigating Scope
|
||||||
|
|
||||||
### Me
|
See [scope](syntax#scope).
|
||||||
|
|
||||||
`$Me` outputs the current object in scope. This will call the `forTemplate` of the object.
|
|
||||||
|
|
||||||
:::ss
|
|
||||||
$Me
|
|
||||||
|
|
||||||
|
|
||||||
### Up
|
|
||||||
|
|
||||||
When in a particular scope, `$Up` takes the scope back to the previous level.
|
|
||||||
|
|
||||||
:::ss
|
|
||||||
<h1>Children of '$Title'</h1>
|
|
||||||
|
|
||||||
<% loop $Children %>
|
|
||||||
<p>Page '$Title' is a child of '$Up.Title'</p>
|
|
||||||
|
|
||||||
<% loop $Children %>
|
|
||||||
<p>Page '$Title' is a grandchild of '$Up.Up.Title'</p>
|
|
||||||
<% end_loop %>
|
|
||||||
<% end_loop %>
|
|
||||||
|
|
||||||
Given the following structure, it will output the text.
|
|
||||||
|
|
||||||
My Page
|
|
||||||
|
|
|
||||||
+-+ Child 1
|
|
||||||
| |
|
|
||||||
| +- Grandchild 1
|
|
||||||
|
|
|
||||||
+-+ Child 2
|
|
||||||
|
|
||||||
Children of 'My Page'
|
|
||||||
|
|
||||||
Page 'Child 1' is a child of 'My Page'
|
|
||||||
Page 'Grandchild 1' is a grandchild of 'My Page'
|
|
||||||
Page 'Child 2' is a child of 'MyPage'
|
|
||||||
|
|
||||||
<div class="notice" markdown="1">
|
|
||||||
Additional selectors implicitely change the scope so you need to put additional `$Up` to get what you expect.
|
|
||||||
</div>
|
|
||||||
|
|
||||||
:::ss
|
|
||||||
<h1>Children of '$Title'</h1>
|
|
||||||
<% loop $Children.Sort('Title').First %>
|
|
||||||
<%-- We have two additional selectors in the loop expression so... --%>
|
|
||||||
<p>Page '$Title' is a child of '$Up.Up.Up.Title'</p>
|
|
||||||
<% end_loop %>
|
|
||||||
|
|
||||||
### Top
|
|
||||||
|
|
||||||
While `$Up` provides us a way to go up one level of scope, `$Top` is a shortcut to jump to the top most scope of the
|
|
||||||
page. The previous example could be rewritten to use the following syntax.
|
|
||||||
|
|
||||||
:::ss
|
|
||||||
<h1>Children of '$Title'</h1>
|
|
||||||
|
|
||||||
<% loop $Children %>
|
|
||||||
<p>Page '$Title' is a child of '$Top.Title'</p>
|
|
||||||
|
|
||||||
<% loop $Children %>
|
|
||||||
<p>Page '$Title' is a grandchild of '$Top.Title'</p>
|
|
||||||
<% end_loop %>
|
|
||||||
<% end_loop %>
|
|
||||||
|
|
||||||
|
|
||||||
## Breadcrumbs
|
## Breadcrumbs
|
||||||
|
|
||||||
|
@ -434,7 +434,7 @@ class DataList extends ViewableData implements SS_List, SS_Filterable, SS_Sortab
|
|||||||
} elseif($numberFuncArgs == 2) {
|
} elseif($numberFuncArgs == 2) {
|
||||||
$whereArguments[func_get_arg(0)] = func_get_arg(1);
|
$whereArguments[func_get_arg(0)] = func_get_arg(1);
|
||||||
} else {
|
} else {
|
||||||
throw new InvalidArgumentException('Incorrect number of arguments passed to exclude()');
|
throw new InvalidArgumentException('Incorrect number of arguments passed to filterAny()');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->alterDataQuery(function($query, $list) use ($whereArguments) {
|
return $this->alterDataQuery(function($query, $list) use ($whereArguments) {
|
||||||
|
@ -8,19 +8,21 @@
|
|||||||
*/
|
*/
|
||||||
class ValidationResult extends Object {
|
class ValidationResult extends Object {
|
||||||
/**
|
/**
|
||||||
* Boolean - is the result valid or not
|
* @var bool - is the result valid or not
|
||||||
*/
|
*/
|
||||||
protected $isValid;
|
protected $isValid;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Array of errors
|
* @var array of errors
|
||||||
*/
|
*/
|
||||||
protected $errorList = array();
|
protected $errorList = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new ValidationResult.
|
* Create a new ValidationResult.
|
||||||
* By default, it is a successful result. Call $this->error() to record errors.
|
* By default, it is a successful result. Call $this->error() to record errors.
|
||||||
|
* @param bool $valid
|
||||||
|
* @param string|null $message
|
||||||
*/
|
*/
|
||||||
public function __construct($valid = true, $message = null) {
|
public function __construct($valid = true, $message = null) {
|
||||||
$this->isValid = $valid;
|
$this->isValid = $valid;
|
||||||
@ -30,8 +32,8 @@ class ValidationResult extends Object {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Record an error against this validation result,
|
* Record an error against this validation result,
|
||||||
* @param $message The validation error message
|
* @param string $message The validation error message
|
||||||
* @param $code An optional error code string, that can be accessed with {@link $this->codeList()}.
|
* @param string $code An optional error code string, that can be accessed with {@link $this->codeList()}.
|
||||||
* @return ValidationResult this
|
* @return ValidationResult this
|
||||||
*/
|
*/
|
||||||
public function error($message, $code = null) {
|
public function error($message, $code = null) {
|
||||||
@ -99,7 +101,7 @@ class ValidationResult extends Object {
|
|||||||
* It will be valid if both this and the other result are valid.
|
* It will be valid if both this and the other result are valid.
|
||||||
* This object will be modified to contain the new validation information.
|
* This object will be modified to contain the new validation information.
|
||||||
*
|
*
|
||||||
* @param ValidationResult the validation result object to combine
|
* @param ValidationResult $other the validation result object to combine
|
||||||
* @return ValidationResult this
|
* @return ValidationResult this
|
||||||
*/
|
*/
|
||||||
public function combineAnd(ValidationResult $other) {
|
public function combineAnd(ValidationResult $other) {
|
||||||
|
Loading…
Reference in New Issue
Block a user