<?php
/*
{
	"id" : "image-container",
	"category": "container",
	"name": "Image Folder"
}
*/

if (!is_file(__DIR__ . "/image-card-container.html")
	|| !is_file(__DIR__ . "/image-card-directory.html"))
	exit( pathinfo(__FILE__, PATHINFO_FILENAME) . ": template not found." );

$SiteShell->append('head', '
	<style type="text/css">
		.artplate--article .modern-minimal--cards-folder { margin: 0.75rem 2.5rem 1.5rem 2.5rem; padding: 0 1.2rem;}
	</style>
');

$sections				= $sw->section_list(array("section_id" => $result["id"]));
$sections				= (new ComponentModule())->data($sections, "1:1")->markupFile( __DIR__ . "/image-card-directory.html"  );

$posts					= $sw->type("article")->limit(24)->posts();
$posts					= (new ComponentModule())->data($posts, "1:1")->markupFile( __DIR__ . "/image-card-directory.html" );

$container_markup				= file_get_contents(__DIR__ . "/image-card-container.html");

$content				= strtr(
		$container_markup,
		array(
				"<!--title-->"										=> $result["title"],
				"<!--context-->"									=> $result["context"],
				"<!--cards_subsections-->"				=> $sections->cards(),
				"<!--cards_main_portfolio-->"			=> $posts->cards(),
				"<!--pagination-->"							=> $posts->pagination(),
		)
);

$SiteShell->replace('article', PHP_EOL . $content);
$SiteShell->render();

