Skip to content

Commit

Permalink
Bluprints: Move validation parameter inside the form
Browse files Browse the repository at this point in the history
  • Loading branch information
mahagr committed Oct 10, 2014
1 parent 5a6e32f commit fd9816c
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion system/blueprints/config/media.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
title: Media
validation: loose

form:
validation: loose
fields:
1 change: 1 addition & 0 deletions system/blueprints/config/site.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
title: Site
form:
validation: loose
fields:

content:
Expand Down
2 changes: 1 addition & 1 deletion system/blueprints/config/streams.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
title: File Streams
validation: loose

form:
validation: loose
fields:
schemes.xxx:
type: array
1 change: 1 addition & 0 deletions system/blueprints/config/system.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
title: System

form:
validation: loose
fields:

content:
Expand Down
1 change: 1 addition & 0 deletions system/blueprints/pages/modular_new.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ rules:
max: 80

form:
validation: loose
fields:

title:
Expand Down
1 change: 1 addition & 0 deletions system/blueprints/pages/modular_raw.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ rules:
max: 80

form:
validation: loose
fields:

tabs:
Expand Down
1 change: 1 addition & 0 deletions system/blueprints/pages/new.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ rules:
max: 80

form:
validation: loose
fields:

title:
Expand Down
1 change: 1 addition & 0 deletions system/blueprints/pages/page.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ rules:
max: 80

form:
validation: loose
fields:

title:
Expand Down
1 change: 1 addition & 0 deletions system/blueprints/pages/raw.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ rules:
max: 80

form:
validation: loose
fields:

tabs:
Expand Down
4 changes: 2 additions & 2 deletions system/src/Grav/Common/Data/Blueprint.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ protected function validateArray(array $data, array $rules)
} elseif (is_array($field) && is_array($val)) {
// Array has been defined in blueprints.
$this->validateArray($field, $val);
} elseif (isset($this->items['validation']) && $this->items['validation'] == 'strict') {
} elseif (isset($this->items['form']['validation']) && $this->items['form']['validation'] == 'strict') {
// Undefined/extra item.
throw new \RuntimeException(sprintf('%s is not defined in blueprints', $key));
}
Expand All @@ -294,7 +294,7 @@ protected function filterArray(array $data, array $rules)
} elseif (is_array($field) && is_array($val)) {
// Array has been defined in blueprints.
$field = $this->filterArray($field, $val);
} elseif (isset($this->items['validation']) && $this->items['validation'] == 'strict') {
} elseif (isset($this->items['form']['validation']) && $this->items['form']['validation'] == 'strict') {
$field = null;
}

Expand Down

0 comments on commit fd9816c

Please sign in to comment.