<?php
$template = <<<END
<!--{def item/title}-->
<!-- pop1_iframe: 埋め込み(iframe) -->
<section class="pop1_iframe">
<div class="list-free">
<!--{ndef item/pos}-->
<div class="text order1">
<h3>{val item/title}</h3>
<p class="mb30 markdown-body">{rval item/contents}</p>
<!--{def item/info_ary}-->
<ul>
<!--{each item/info_ary}-->
<li>{val item/info_ary}</li>
<!--{/each}-->
</ul>
<!--{/def}-->
</div>
<div class="w2 order2">
<div class="iframe-box">
{val item/url}
</div>
</div>
<!--{/ndef}-->
<!--{def item/pos}-->
<div class="text order2">
<h3>{val item/title}</h3>
<div class="mb30 markdown-body">{rval item/contents}</div>
<!--{def item/info_ary}-->
<ul>
<!--{each item/info_ary}-->
<li>{rval item/info_ary}</li>
<!--{/each}-->
</ul>
<!--{/def}-->
</div>
<div class="w2 order1">
<div class="iframe-box">
{val item/url}
</div>
</div>
<!--{/def}-->
</div>
<!--/.list-free-->
</section>
<!--{/def}-->
END;

$pop1_iframe = array(
		"title" => "POP1埋め込み(iframe)",
		"name" => "pop1_iframe",			// 名称、重複すると正しく動作しません
		"template" => $template,		// ブロックのテンプレートファイル
		"input" => array(	// GoogleMap
		"help" => array(
			"title" => "使い方",
			"type" => "comment",
			"link" => DOCUMENT1 . "/?act=pop1_iframe",
			"class" => "notice",
		),
			"title" => array(
				"title" => "タイトル",
				"type" => "text",
			),
			"pos" => array(
				"title" => "配置",
				"type" => "select",
				"list" => array(
					"" => "右配置",
					"1" => "左配置",
				),
			),
			"url" => array(
				"title" => "リンク",
				"type" => "text",
				"info" => "iframeのリンクを記入してください",
			),
			"contents" => array(
				"title" => "説明",
				"type" => "textarea",
			),
			"info" => array(
				"title" => "追加情報",
				"type" => "textarea",
				"info" => "行単位の箇条書きになります",
			),
		),
		"func" => "func_pop1_iframe",		// 処理プログラム（指定がない物は標準処理）
	);

block_add($pop1_iframe);

// iframe
function func_pop1_iframe($def, $info)
{
	// 箇条書き
	$ary = explode("\n", trim($info["info"]));
	foreach ($ary as $key => $val) {
		if (trim($val)) {
			$ary2[] = trim($val);
		}
	}
	if ($ary2) {
		$info["info_ary"] = $ary2;
	}
	return $info;
}
