ArrayData

Lets you wrap a bunch of array data into a ViewableData object. For an example of ArrayData in use, see tutorial:3-forms: Showing the poll results

Here is an example of simply turning an Array into a ViewableData object so that it can displayed in a template:

// Create new data object set containing the subscribers who have not been sent this newsletter:
$unsent_subscribers = new DataObjectSet();
foreach($unsent_subscribers_array as $key => $data) {
	$unsent_subscribers->push(new ArrayData($data));
}
return $unsent_subscribers;

Above code taken from cms/code/Newsletter/Newsletter.php gsoc branch r38859.

API Documentation

 
arraydata.txt · Last modified: 2009/03/23 08:36

Please use comments for notes, tips and corrections about the described functionality.
Use the Silverstripe Forum to ask questions.

blog comments powered by Disqus
 
Creative Commons LicenseSilverStripe Documentation by SilverStripe is licensed under a Creative Commons Attribution 3.0 New Zealand License.
Based on a work at doc.silverstripe.com
Recent changes RSS feed Driven by DokuWiki