Skip to content

Commit

Permalink
Preparse any associated page yaml data
Browse files Browse the repository at this point in the history
  • Loading branch information
kolber committed Apr 17, 2013
1 parent f62928f commit 13baf75
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions app/asset-types/asset-factory.inc.php
Expand Up @@ -13,7 +13,7 @@ static function extract_page_data($asset_path) {

# return any page data scoped against the asset filename
$page_data = self::get($page_path);
return isset($page_data[strtolower($file_name)]) ? $page_data[strtolower($file_name)] : false;
return isset($page_data[strtolower($file_name)]) ? $page_data[strtolower($file_name)] : array();
}

static function &create($file_path) {
Expand Down Expand Up @@ -42,7 +42,10 @@ static function &create($file_path) {
$page_data = self::extract_page_data($file_path);
# create a new asset and return its data
$asset = new $asset($file_path);
$merged_data = array_merge($asset->data, is_array($page_data) ? $page_data : array());
# Parse the page data
$page_data = PageData::parse_vars($page_data, true, "");
# Merge original data with associated page data
$merged_data = array_merge($asset->data, $page_data);
return $merged_data;

} else {
Expand Down Expand Up @@ -71,4 +74,4 @@ static function get_asset_subclasses() {

}

?>
?>

0 comments on commit 13baf75

Please sign in to comment.