<?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
 */

// Arrays generieren, die die Informationen beinhalten, welche Metainfos in welchem Typ
// vorhanden sind.

$isMeta    = sly_Core::getCurrentControllerName() === 'contentmeta';
$metainfos = array();

foreach (sly_Service_Factory::getArticleTypeService()->getArticleTypes() as $artType => $title) {
	$metainfos[$artType] = array();

	foreach (WV2_MetaProvider::getMetaInfosForArticleType($artType) as $info) {
		// Ausgabe unnötiger Elemente vermeiden
		if ($info->getMetapage() !== $isMeta) {
			continue;
		}

		$metainfos[$artType][] = $info->getID();
	}
}

sly_Core::getLayout()->addJavaScript('var wv2={}; wv2.infosPerType='.json_encode($metainfos).';');
