{
	"$schema": "https://playground.wordpress.net/blueprint-schema.json",
	"meta": {
		"title": "Blocks for ACF Fields demo",
		"description": "A sample post whose ACF fields are displayed with the Blocks for ACF Fields blocks.",
		"author": "gamaup",
		"categories": [
			"Blocks"
		]
	},
	"landingPage": "/wp-admin/post.php?post=1001&action=edit",
	"preferredVersions": {
		"php": "8.2",
		"wp": "latest"
	},
	"features": {
		"networking": true
	},
	"login": true,
	"steps": [
		{
			"step": "installPlugin",
			"pluginData": {
				"resource": "wordpress.org/plugins",
				"slug": "advanced-custom-fields"
			}
		},
		{
			"step": "installPlugin",
			"pluginData": {
				"resource": "wordpress.org/plugins",
				"slug": "acf-field-blocks"
			}
		},
		{
			"step": "writeFile",
			"path": "/wordpress/wp-content/mu-plugins/afb-demo-fields.php",
			"data": "<?php\n/**\n * Plugin Name: Blocks for ACF Fields – Playground demo fields\n * Description: Registers the demo field group used by the WordPress Playground demo.\n *\n * Installed as a mu-plugin by playground/blueprint.json. Not shipped with the plugin.\n */\n\nadd_action(\n\t'acf/include_fields',\n\tfunction () {\n\t\tif ( ! function_exists( 'acf_add_local_field_group' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tacf_add_local_field_group(\n\t\t\tarray(\n\t\t\t\t'key'      => 'group_afb_demo_book',\n\t\t\t\t'title'    => 'Book Details',\n\t\t\t\t'fields'   => array(\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'key'   => 'field_afb_demo_subtitle',\n\t\t\t\t\t\t'label' => 'Subtitle',\n\t\t\t\t\t\t'name'  => 'subtitle',\n\t\t\t\t\t\t'type'  => 'text',\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'key'   => 'field_afb_demo_author',\n\t\t\t\t\t\t'label' => 'Author',\n\t\t\t\t\t\t'name'  => 'author_name',\n\t\t\t\t\t\t'type'  => 'text',\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'key'           => 'field_afb_demo_cover',\n\t\t\t\t\t\t'label'         => 'Cover',\n\t\t\t\t\t\t'name'          => 'cover',\n\t\t\t\t\t\t'type'          => 'image',\n\t\t\t\t\t\t'return_format' => 'array',\n\t\t\t\t\t\t'preview_size'  => 'medium',\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'key'   => 'field_afb_demo_price',\n\t\t\t\t\t\t'label' => 'Price',\n\t\t\t\t\t\t'name'  => 'price',\n\t\t\t\t\t\t'type'  => 'number',\n\t\t\t\t\t\t'step'  => 0.01,\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'key'   => 'field_afb_demo_pages',\n\t\t\t\t\t\t'label' => 'Pages',\n\t\t\t\t\t\t'name'  => 'pages',\n\t\t\t\t\t\t'type'  => 'number',\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'key'   => 'field_afb_demo_rating',\n\t\t\t\t\t\t'label' => 'Rating',\n\t\t\t\t\t\t'name'  => 'rating',\n\t\t\t\t\t\t'type'  => 'range',\n\t\t\t\t\t\t'min'   => 0,\n\t\t\t\t\t\t'max'   => 5,\n\t\t\t\t\t\t'step'  => 0.1,\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'key'            => 'field_afb_demo_published',\n\t\t\t\t\t\t'label'          => 'Published',\n\t\t\t\t\t\t'name'           => 'published',\n\t\t\t\t\t\t'type'           => 'date_picker',\n\t\t\t\t\t\t'display_format' => 'd/m/Y',\n\t\t\t\t\t\t'return_format'  => 'd/m/Y',\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'key'           => 'field_afb_demo_genres',\n\t\t\t\t\t\t'label'         => 'Genres',\n\t\t\t\t\t\t'name'          => 'genres',\n\t\t\t\t\t\t'type'          => 'checkbox',\n\t\t\t\t\t\t'choices'       => array(\n\t\t\t\t\t\t\t'scifi'   => 'Science Fiction',\n\t\t\t\t\t\t\t'mystery' => 'Mystery',\n\t\t\t\t\t\t\t'drama'   => 'Drama',\n\t\t\t\t\t\t\t'cozy'    => 'Cozy',\n\t\t\t\t\t\t),\n\t\t\t\t\t\t'return_format' => 'label',\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'key'   => 'field_afb_demo_in_stock',\n\t\t\t\t\t\t'label' => 'In stock',\n\t\t\t\t\t\t'name'  => 'in_stock',\n\t\t\t\t\t\t'type'  => 'true_false',\n\t\t\t\t\t\t'ui'    => 1,\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'key'           => 'field_afb_demo_genre_icon',\n\t\t\t\t\t\t'label'         => 'Genre icon',\n\t\t\t\t\t\t'name'          => 'genre_icon',\n\t\t\t\t\t\t'type'          => 'icon_picker',\n\t\t\t\t\t\t'tabs'          => array( 'dashicons' ),\n\t\t\t\t\t\t'return_format' => 'array',\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'key'          => 'field_afb_demo_summary',\n\t\t\t\t\t\t'label'        => 'Summary',\n\t\t\t\t\t\t'name'         => 'summary',\n\t\t\t\t\t\t'type'         => 'wysiwyg',\n\t\t\t\t\t\t'media_upload' => 0,\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'key'           => 'field_afb_demo_buy_link',\n\t\t\t\t\t\t'label'         => 'Buy link',\n\t\t\t\t\t\t'name'          => 'buy_link',\n\t\t\t\t\t\t'type'          => 'link',\n\t\t\t\t\t\t'return_format' => 'array',\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'key'   => 'field_afb_demo_trailer',\n\t\t\t\t\t\t'label' => 'Trailer',\n\t\t\t\t\t\t'name'  => 'trailer',\n\t\t\t\t\t\t'type'  => 'oembed',\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t\t'location' => array(\n\t\t\t\t\tarray(\n\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t'param'    => 'post_type',\n\t\t\t\t\t\t\t'operator' => '==',\n\t\t\t\t\t\t\t'value'    => 'post',\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t\t'position' => 'normal',\n\t\t\t)\n\t\t);\n\t}\n);\n"
		},
		{
			"step": "runPHP",
			"code": "<?php\n/**\n * One-time setup for the WordPress Playground demo.\n *\n * Runs once as a blueprint `runPHP` step, after ACF, this plugin and\n * demo-fields.php are installed. Creates the cover image, the demo post with\n * its field values, and hides the editor welcome guide.\n */\n\nrequire_once '/wordpress/wp-load.php';\nrequire_once ABSPATH . 'wp-admin/includes/image.php';\n\n// Act as the admin so the block markup is saved without KSES filtering.\nwp_set_current_user( 1 );\n\nconst AFB_DEMO_POST_ID = 1001;\n\n/**\n * Draws a simple book cover with GD, so the demo needs no remote image.\n *\n * @return int Attachment ID, or 0 on failure.\n */\nfunction afb_demo_create_cover() {\n\tif ( ! function_exists( 'imagecreatetruecolor' ) ) {\n\t\treturn 0;\n\t}\n\n\t$width  = 600;\n\t$height = 900;\n\t$image  = imagecreatetruecolor( $width, $height );\n\n\t// Vertical gradient from deep navy to violet.\n\tfor ( $y = 0; $y < $height; $y++ ) {\n\t\t$t     = $y / $height;\n\t\t$color = imagecolorallocate( $image, (int) ( 20 + 70 * $t ), (int) ( 24 + 20 * $t ), (int) ( 64 + 80 * $t ) );\n\t\timageline( $image, 0, $y, $width, $y, $color );\n\t}\n\n\t// Planet and orbits.\n\t$orbit  = imagecolorallocatealpha( $image, 255, 255, 255, 90 );\n\t$planet = imagecolorallocate( $image, 255, 196, 92 );\n\timagesetthickness( $image, 2 );\n\tforeach ( array( 260, 380, 500 ) as $size ) {\n\t\timageellipse( $image, 300, 380, $size, (int) ( $size * 0.45 ), $orbit );\n\t}\n\timagefilledellipse( $image, 300, 380, 150, 150, $planet );\n\timagefilledellipse( $image, 470, 330, 22, 22, imagecolorallocate( $image, 240, 240, 255 ) );\n\n\t// Title text: draw with the built-in font on a small canvas, then scale up.\n\t$lines = array(\n\t\tarray( 'THE QUIET', 4, 680 ),\n\t\tarray( 'ORBIT', 4, 740 ),\n\t\tarray( 'MAYA HALVORSEN', 2, 830 ),\n\t);\n\tforeach ( $lines as $line ) {\n\t\tlist( $text, $scale, $top ) = $line;\n\t\t$small_w = imagefontwidth( 5 ) * strlen( $text );\n\t\t$small_h = imagefontheight( 5 );\n\t\t$small   = imagecreatetruecolor( $small_w, $small_h );\n\t\t$bg      = imagecolorallocate( $small, 1, 2, 3 );\n\t\timagefill( $small, 0, 0, $bg );\n\t\timagecolortransparent( $small, $bg );\n\t\timagestring( $small, 5, 0, 0, $text, imagecolorallocate( $small, 255, 255, 255 ) );\n\t\t$dst_w = $small_w * $scale;\n\t\timagecopyresized( $image, $small, (int) ( ( $width - $dst_w ) / 2 ), $top, 0, 0, $dst_w, $small_h * $scale, $small_w, $small_h );\n\t\timagedestroy( $small );\n\t}\n\n\t$upload = wp_upload_dir();\n\twp_mkdir_p( $upload['path'] );\n\t$file = trailingslashit( $upload['path'] ) . 'the-quiet-orbit-cover.png';\n\timagepng( $image, $file );\n\timagedestroy( $image );\n\n\t$attachment_id = wp_insert_attachment(\n\t\tarray(\n\t\t\t'post_title'     => 'The Quiet Orbit – cover',\n\t\t\t'post_mime_type' => 'image/png',\n\t\t\t'post_status'    => 'inherit',\n\t\t),\n\t\t$file\n\t);\n\tif ( is_wp_error( $attachment_id ) || ! $attachment_id ) {\n\t\treturn 0;\n\t}\n\twp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $file ) );\n\tupdate_post_meta( $attachment_id, '_wp_attachment_image_alt', 'Cover of The Quiet Orbit' );\n\n\treturn (int) $attachment_id;\n}\n\n$afb_demo_content = <<<'HTML'\n<!-- wp:paragraph {\"style\":{\"typography\":{\"fontSize\":\"0.9rem\"}},\"backgroundColor\":\"accent-5\"} -->\n<p class=\"has-accent-5-background-color has-background\" style=\"font-size:0.9rem\"><strong>Demo of Blocks for ACF Fields.</strong> Everything below the title (cover, price, rating, date, button, video) is an ACF field on this post, shown with the plugin's blocks. Click any of them to change how it is displayed, or edit the values in the <em>Book Details</em> box below the editor.</p>\n<!-- /wp:paragraph -->\n\n<!-- wp:columns {\"style\":{\"spacing\":{\"blockGap\":{\"left\":\"3rem\"}}}} -->\n<div class=\"wp-block-columns\">\n<!-- wp:column {\"width\":\"38%\"} -->\n<div class=\"wp-block-column\" style=\"flex-basis:38%\">\n<!-- wp:acf-field-blocks/acf-image {\"fieldKey\":\"field_afb_demo_cover\",\"fieldSource\":\"current_post\",\"aspectRatio\":\"2/3\",\"sizeSlug\":\"large\",\"style\":{\"border\":{\"radius\":\"8px\"}},\"shadow\":\"var:preset|shadow|natural\"} /-->\n</div>\n<!-- /wp:column -->\n\n<!-- wp:column {\"width\":\"62%\"} -->\n<div class=\"wp-block-column\" style=\"flex-basis:62%\">\n<!-- wp:acf-field-blocks/acf-text {\"fieldKey\":\"field_afb_demo_subtitle\",\"fieldSource\":\"current_post\",\"tag\":\"h2\",\"style\":{\"typography\":{\"fontSize\":\"1.75rem\"},\"spacing\":{\"margin\":{\"top\":\"0\"}}}} /-->\n\n<!-- wp:acf-field-blocks/acf-text {\"fieldKey\":\"field_afb_demo_author\",\"fieldSource\":\"current_post\",\"prefix\":\"by \",\"style\":{\"typography\":{\"fontStyle\":\"italic\"}}} /-->\n\n<!-- wp:group {\"layout\":{\"type\":\"flex\",\"flexWrap\":\"wrap\",\"verticalAlignment\":\"center\"},\"style\":{\"spacing\":{\"blockGap\":\"0.5rem\"}}} -->\n<div class=\"wp-block-group\">\n<!-- wp:acf-field-blocks/acf-icon {\"fieldKey\":\"field_afb_demo_genre_icon\",\"fieldSource\":\"current_post\",\"iconSize\":22} /-->\n\n<!-- wp:acf-field-blocks/acf-text {\"fieldKey\":\"field_afb_demo_genres\",\"fieldSource\":\"current_post\",\"tag\":\"span\",\"returnFormat\":\"label\",\"separator\":\" · \",\"style\":{\"typography\":{\"textTransform\":\"uppercase\",\"letterSpacing\":\"0.08em\",\"fontSize\":\"0.85rem\"}}} /-->\n</div>\n<!-- /wp:group -->\n\n<!-- wp:group {\"layout\":{\"type\":\"flex\",\"flexWrap\":\"wrap\"},\"style\":{\"spacing\":{\"blockGap\":\"1.5rem\",\"margin\":{\"top\":\"1.5rem\",\"bottom\":\"1.5rem\"}}}} -->\n<div class=\"wp-block-group\" style=\"margin-top:1.5rem;margin-bottom:1.5rem\">\n<!-- wp:acf-field-blocks/acf-text {\"fieldKey\":\"field_afb_demo_price\",\"fieldSource\":\"current_post\",\"tag\":\"span\",\"prefix\":\"$\",\"formatNumber\":true,\"numberDecimals\":2,\"numberDecimalSeparator\":\".\",\"numberThousandsSeparator\":\",\",\"style\":{\"typography\":{\"fontSize\":\"2rem\",\"fontWeight\":\"700\"}}} /-->\n\n<!-- wp:acf-field-blocks/acf-text {\"fieldKey\":\"field_afb_demo_in_stock\",\"fieldSource\":\"current_post\",\"tag\":\"span\",\"checkedText\":\"✔ In stock\",\"uncheckedText\":\"Sold out\",\"textColor\":\"accent-3\"} /-->\n</div>\n<!-- /wp:group -->\n\n<!-- wp:acf-field-blocks/acf-text {\"fieldKey\":\"field_afb_demo_rating\",\"fieldSource\":\"current_post\",\"prefix\":\"★ \",\"suffix\":\" / 5 reader rating\",\"formatNumber\":true,\"numberDecimals\":1} /-->\n\n<!-- wp:acf-field-blocks/acf-text {\"fieldKey\":\"field_afb_demo_published\",\"fieldSource\":\"current_post\",\"prefix\":\"Published \",\"dateFormatMode\":\"preset\",\"datePreset\":\"F j, Y\"} /-->\n\n<!-- wp:acf-field-blocks/acf-text {\"fieldKey\":\"field_afb_demo_pages\",\"fieldSource\":\"current_post\",\"suffix\":\" pages\",\"formatNumber\":true,\"numberThousandsSeparator\":\",\"} /-->\n\n<!-- wp:acf-field-blocks/acf-button {\"fieldKey\":\"field_afb_demo_buy_link\",\"fieldSource\":\"current_post\",\"customText\":\"Get the book\",\"linkTarget\":\"_blank\"} /-->\n</div>\n<!-- /wp:column -->\n</div>\n<!-- /wp:columns -->\n\n<!-- wp:heading -->\n<h2 class=\"wp-block-heading\">About the book</h2>\n<!-- /wp:heading -->\n\n<!-- wp:acf-field-blocks/acf-text {\"fieldKey\":\"field_afb_demo_summary\",\"fieldSource\":\"current_post\",\"tag\":\"div\"} /-->\n\n<!-- wp:heading -->\n<h2 class=\"wp-block-heading\">Trailer</h2>\n<!-- /wp:heading -->\n\n<!-- wp:acf-field-blocks/acf-embed {\"fieldKey\":\"field_afb_demo_trailer\",\"fieldSource\":\"current_post\",\"showMessageIfEmpty\":true,\"emptyMessage\":\"The trailer could not be loaded in this sandbox.\"} /-->\nHTML;\n\n$afb_demo_cover = afb_demo_create_cover();\n\n$afb_demo_post = wp_insert_post(\n\tarray(\n\t\t'import_id'    => AFB_DEMO_POST_ID,\n\t\t'post_type'    => 'post',\n\t\t'post_status'  => 'publish',\n\t\t'post_title'   => 'The Quiet Orbit',\n\t\t'post_name'    => 'the-quiet-orbit',\n\t\t'post_author'  => 1,\n\t\t'post_content' => $afb_demo_content,\n\t),\n\ttrue\n);\n\nif ( is_wp_error( $afb_demo_post ) ) {\n\treturn;\n}\n\n// No featured image on purpose: the theme would show the cover a second time.\nif ( $afb_demo_cover ) {\n\tupdate_field( 'field_afb_demo_cover', $afb_demo_cover, $afb_demo_post );\n}\n\n$afb_demo_values = array(\n\t'field_afb_demo_subtitle'   => 'A small station at the edge of the map',\n\t'field_afb_demo_author'     => 'Maya Halvorsen',\n\t'field_afb_demo_price'      => 24.5,\n\t'field_afb_demo_pages'      => 1312,\n\t'field_afb_demo_rating'     => 4.6,\n\t'field_afb_demo_published'  => '20250314',\n\t'field_afb_demo_genres'     => array( 'scifi', 'mystery', 'cozy' ),\n\t'field_afb_demo_in_stock'   => 1,\n\t'field_afb_demo_genre_icon' => array(\n\t\t'type'  => 'dashicons',\n\t\t'value' => 'dashicons-book-alt',\n\t),\n\t'field_afb_demo_summary'    => '<p>On a relay station that nobody has visited in eleven years, keeper <strong>Ines Moreau</strong> receives a signal addressed to someone who died before she was born.</p><p>Part mystery, part slow-burn character study, <em>The Quiet Orbit</em> is a story about the small routines that keep a person going when the rest of the world has moved on.</p>',\n\t'field_afb_demo_buy_link'   => array(\n\t\t'title'  => 'Get the book',\n\t\t'url'    => 'https://wordpress.org/',\n\t\t'target' => '_blank',\n\t),\n\t'field_afb_demo_trailer'    => 'https://www.youtube.com/watch?v=lTDoTBOz9Vw',\n);\nforeach ( $afb_demo_values as $afb_demo_key => $afb_demo_value ) {\n\tupdate_field( $afb_demo_key, $afb_demo_value, $afb_demo_post );\n}\n\n// Skip the block editor welcome guide so the demo opens straight on the post.\nupdate_user_meta(\n\t1,\n\t$GLOBALS['wpdb']->get_blog_prefix() . 'persisted_preferences',\n\tarray(\n\t\t'core/edit-post' => array( 'welcomeGuide' => false ),\n\t\t'core'           => array( 'editorMode' => 'visual' ),\n\t\t'_modified'      => gmdate( 'c' ),\n\t)\n);\n"
		}
	]
}
