<?php
/*
 * Copyright (c) 2013, webvariants GbR, http://www.webvariants.de
 *
 * This file is released under the terms of the MIT license. You can find the
 * complete text in the attached LICENSE file or online at:
 *
 * http://www.opensource.org/licenses/mit-license.php
 */

$canView = _WV2_Metainfo::isAllowed('view');
$canEdit = _WV2_Metainfo::isAllowed('edit');

foreach ($dataToDisplay as $groupName => $group) {
	foreach ($group as $data) {
		$value = $data['value'];
		$info  = $data['info'];

		if ($canEdit) {
			$info->renderForm($form, array($value));
		}
		else {
			$value = $info->deserialize($value);
			$text  = new sly_Form_Text($info->getTitle(), is_array($value) ? implode(', ', $value) : $value);
			$form->add($text);
		}
	}
}
