<?php
$template = <<<END
<!-- block_kiji: 記事２ -->
<section class="block_kiji class_{val id}">
<!--{def item/type1}-->
<!-- 1 上画像＋記事 -->

<!--{def item/title}-->
<h2>{val item/title}</h2>
<!--{/def}-->

<!--{def item/image_file}-->
<figure class="mb1rem"><img src="user_data/{val item/image_file}" alt=""></figure>
<!--{/def}-->

<!--{def item/subtitle}-->
<h3>{val item/subtitle}</h3>
<!--{/def}-->

<p class="markdown-body">{rval item/text}</p>
<!--{/def}-->

<!--{def item/type2}-->
<!-- 2 記事＋下画像 -->

<!--{def item/title}-->
<h2>{val item/title}</h2>
<!--{/def}-->

<!--{def item/subtitle}-->
<h3>{val item/subtitle}</h3>
<!--{/def}-->

<p class="markdown-body">{rval item/text}</p>

<!--{def item/image_file}-->
<figure><img src="user_data/{val item/image_file}" alt=""></figure>
<!--{/def}-->

<!--{/def}-->

<!--{def item/type3}-->
<!-- 3 左画像＋記事 -->

<!--{def item/title}-->
<h2>{val item/title}</h2>
<!--{/def}-->

<div class="list-half-kiji">
<div class="list-kiji">

<div class="text-kiji">

<!--{def item/subtitle}-->
<h4>{val item/subtitle}</h4>
<!--{/def}-->

<p class="markdown-body">{rval item/text}</p>

</div>

<!--{def item/image_file}-->
<div class="image-l-kiji">
<figure><img src="user_data/{val item/image_file}" alt=""></figure>
</div>
<!--{/def}-->

</div>
</div>
<!--{/def}-->

<!--{def item/type4}-->
<!-- 4 記事＋右画像 -->

<!--{def item/title}-->
<h2>{val item/title}</h2>
<!--{/def}-->

<div class="list-half-kiji">
<div class="list-kiji">

<div class="text-kiji">

<!--{def item/subtitle}-->
<h4>{val item/subtitle}</h4>
<!--{/def}-->

<p class="markdown-body">{rval item/text}</p>

</div>

<!--{def item/image_file}-->
<div class="image-r-kiji">
<figure><img src="user_data/{val item/image_file}" alt=""></figure>
</div>
<!--{/def}-->

</div>
</div>
<!--{/def}-->

</section>
END;

$block_kiji = array(
	"title" => "記事（上下左右）",
	"name" => "block_kiji",			// 名称、重複すると正しく動作しません
	"template" => $template,		// ブロックのテンプレート
	"input" => array(
		"help" => array(
			"title" => "使い方",
			"type" => "comment",
			"link" => DOCUMENT1 . "/?act=block_kiji",
			"class" => "notice",
		),
		"title" => array(
			"title" => "タイトル",
			"type" => "text",
		),
		"type" => array(
			"title" => "書式",
			"type" => "select",
			"list" => array(
				"1" => "上画像＋記事",
				"2" => "記事＋下画像",
				"3" => "左画像＋記事",
				"4" => "記事＋右画像",
			),
		),
		"subtitle" => array(
			"title" => "サブタイトル",
			"type" => "text",
		),
		"image" => array(
			"title" => "画像",
			"type" => "image",
		),
		"text" => array(
			"title" => "説明",
			"type" => "textarea",
		),
	),
	"func" => "func_block_kiji",		// 処理プログラム（指定がない物は標準処理）
);

block_add($block_kiji);

// 記事2
function func_block_kiji($def, $info)
{
	$info["type" . $info["type"]] = $info["type"];
	return $info;
}
