Skip to content

Commit

Permalink
Fix blueprint @extends with external context (regression from #38)
Browse files Browse the repository at this point in the history
  • Loading branch information
mahagr committed Aug 21, 2015
1 parent e750e1b commit 056ad33
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion system/src/Grav/Common/Data/Blueprint.php
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ protected function parseFormFields(array &$fields, $params, $prefix, array &$cur
$field['name'] = $prefix . $key;
$field += $params;

if (isset($field['fields']) && $field['type'] !== 'list') {
if (isset($field['fields']) && (!isset($field['type']) || $field['type'] !== 'list')) {
// Recursively get all the nested fields.
$newParams = array_intersect_key($this->filter, $field);
$this->parseFormFields($field['fields'], $newParams, $prefix, $current[$key]['fields']);
Expand Down
14 changes: 13 additions & 1 deletion system/src/Grav/Common/Data/Blueprints.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,19 @@ public function get($type)
continue;
}

$context = is_string($extendConfig) || empty($extendConfig['context']) ? $this : new self(self::getGrav()['locator']->findResource($extendConfig['context']));
if (is_string($extendConfig) || empty($extendConfig['context'])) {
$context = $this;
} else {
// Load blueprints from external context.
$array = explode('://', $extendConfig['context'], 2);
$scheme = array_shift($array);
$path = array_shift($array);
if ($path) {
$scheme .= '://';
$extendType = $path ? "{$path}/{$extendType}" : $extendType;
}
$context = new self($scheme);
}
$blueprint->extend($context->get($extendType));
}
}
Expand Down

0 comments on commit 056ad33

Please sign in to comment.