Last active
December 20, 2015 12:29
-
-
Save wernerkrauss/6131156 to your computer and use it in GitHub Desktop.
Decorator for DataObject for retrieving $summary_fields in templates.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Class DataObjectSummaryExtension | |
* @author Werner Krauß <werner.krauss@netwerkstatt.at> | |
*/ | |
class DataObjectSummaryExtension extends DataExtension { | |
/** | |
* Returns an ArrayList for looping over $summary_fields in templates | |
* @return ArrayList | |
*/ | |
public function getSummaryFieldsForTemplate(){ | |
$summaryList = new ArrayList(); | |
$summary = $this->owner->summaryFields(); | |
foreach ($summary as $field => $value) { | |
$summaryList->push(array( | |
'Name' => $value, | |
'Value' => $this->owner->$field | |
)); | |
} | |
return $summaryList; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment