{
    "$schema": "https://playground.wordpress.net/blueprint-schema.json",
    "landingPage": "/wp-admin/admin.php?page=lfw_layouts",
    "preferredVersions": {
        "php": "8.1",
        "wp": "latest"
    },
    "features": {
        "networking": true
    },
    "login": true,
    "steps": [
        {
            "step": "installPlugin",
            "pluginData": {
                "resource": "wordpress.org/plugins",
                "slug": "layouts-for-wpbakery"
            },
            "options": {
                "activate": true
            }
        },
        {
            "step": "writeFile",
            "path": "/wordpress/wp-content/mu-plugins/lfw-playground-preview.php",
            "data": "<?php\n/**\n * Plugin Name: Layouts for WPBakery - Playground preview\n * Description: WordPress Playground preview helper only; never shipped with the plugin.\n *\n * WPBakery Page Builder is a commercial product that can't be installed in Playground, and\n * Layouts for WPBakery only adds its \"Layouts\" screen when WPBakery is active. This\n * exposes that same screen (the plugin's own includes/layouts.php template)\n * so visitors can browse and preview the real, live layout library.\n */\nadd_action(\n\t'admin_menu',\n\tfunction () {\n\t\tif ( defined( 'WPB_VC_VERSION' ) || ! defined( 'LFW_DIR' ) ) {\n\t\t\treturn;\n\t\t}\n\t\tadd_menu_page(\n\t\t\t'Layouts',\n\t\t\t'Layouts',\n\t\t\t'manage_options',\n\t\t\t'lfw_layouts',\n\t\t\tfunction () {\n\t\t\t\tinclude LFW_DIR . 'includes/layouts.php';\n\t\t\t},\n\t\t\tLFW_URL . 'assets/images/layouts-for-wpbakery.png'\n\t\t);\n\t}\n);\n\n// Replace the plugin's \"install WPBakery\" notice with an explanation of this preview.\nadd_action(\n\t'admin_init',\n\tfunction () {\n\t\tglobal $wp_filter;\n\t\tif ( isset( $wp_filter['admin_notices'] ) ) {\n\t\t\tforeach ( $wp_filter['admin_notices']->callbacks as $priority => $callbacks ) {\n\t\t\t\tforeach ( $callbacks as $callback ) {\n\t\t\t\t\tif ( is_array( $callback['function'] ) && $callback['function'][0] instanceof Layouts_For_WPBakery ) {\n\t\t\t\t\t\tremove_action( 'admin_notices', $callback['function'], $priority );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n);\nadd_action(\n\t'admin_notices',\n\tfunction () {\n\t\techo '<div class=\"notice notice-info\"><p><strong>Layouts for WPBakery preview.</strong> Browse and preview the live layout library here. Importing requires the WPBakery Page Builder plugin (a commercial product), which isn\\'t available in this Playground.</p></div>';\n\t}\n);\n"
        },
        {
            "step": "runPHP",
            "code": "<?php\nrequire_once \"/wordpress/wp-load.php\";\n\n// Warm the plugin's own template/category caches with one real request each\n// (the same requests its \"Sync Now\" button makes), so the landing page renders\n// the live library immediately.\nif ( class_exists( \"Layouts_WPB_Remote\" ) ) {\n\t$remote = Layouts_WPB_Remote::lfw_get_instance();\n\t$remote->templates_list( true );\n\t$remote->categories_list( true );\n}\n"
        }
    ]
}
