Permalink
Browse files

Applied fix to page (object) model class so that newly configured fie…

…lds will show up in getPageContent, and are not dependent on their mappings already beings set up
  • Loading branch information...
1 parent 6abac4e commit ae89ea4845aefd006e6abc65eedc3ea56e845e38 Deepwinter committed Jun 1, 2011
Showing with 7 additions and 7 deletions.
  1. +7 −7 modules/mopcms/classes/model/page.php
@@ -177,14 +177,14 @@ public function getPageContent(){
$content['dateadded'] = $this->dateadded;
$content['templateName'] = $this->template->templatename;
- $fields = ORM::Factory('objectmap')
- ->where('template_id', '=', $this->template->id)
- ->find_all();
- foreach($fields as $map){
- if(mop::config('objects', sprintf('//template[@name="%s"]/elements/*[@field="%s"]', $this->template->templatename, $map->column))->length){
- $content[$map->column] = $this->contenttable->{$map->column};
+ $fields = mop::config('objects', sprintf('//template[@name="%s"]/elements/*', $this->template->templatename));
+
+ foreach ($fields as $fieldInfo) {
+ $field = $fieldInfo->getAttribute('field');
+ if (mop::config('objects', sprintf('//template[@name="%s"]/elements/*[@field="%s"]', $this->template->templatename, $field))->length) {
+ $content[$field] = $this->contenttable->{$field};
+ }
}
- }
//find any lists
foreach(mop::config('objects', sprintf('//template[@name="%s"]/elements/list', $this->template->templatename)) as $list){

0 comments on commit ae89ea4

Please sign in to comment.