[
  {
    "id": 3593,
    "title": "制限エリア_P-36",
    "icon": "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewbox=\"0 0 256 256\"><path d=\"M208,88H48a8,8,0,0,0-8,8V208a8,8,0,0,0,8,8H208a8,8,0,0,0,8-8V96A8,8,0,0,0,208,88Zm-80,72a20,20,0,1,1,20-20A20,20,0,0,1,128,160Z\" fill=\"#9aa8c9\"/><path d=\"M208,80H176V56a48,48,0,0,0-96,0V80H48A16,16,0,0,0,32,96V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V96A16,16,0,0,0,208,80ZM96,56a32,32,0,0,1,64,0V80H96ZM208,208H48V96H208V208Zm-80-96a28,28,0,0,0-8,54.83V184a8,8,0,0,0,16,0V166.83A28,28,0,0,0,128,112Zm0,40a12,12,0,1,1,12-12A12,12,0,0,1,128,152Z\" fill=\"#1a1a2e\"/></svg>",
    "keywords": [
      "制限",
      "restricted",
      "ログイン",
      "会員限定",
      "レイアウト・デザイン",
      "制限エリア"
    ],
    "slug": "lazyblock/f-restricted-area-pro",
    "description": "ログイン状態や権限（ロール）に応じて、表示する内容を切り替えられるブロックです。",
    "category": "Lazyblocks Pro",
    "category_label": "Lazyblocks Pro",
    "supports": {
      "customClassName": true,
      "anchor": false,
      "html": false,
      "multiple": true,
      "inserter": true,
      "reusable": true,
      "color": false,
      "layout": false,
      "shadow": false,
      "spacing": false,
      "dimensions": false,
      "typography": false,
      "lock": true,
      "align": [
        "wide",
        "full"
      ],
      "ghostkit": {
        "effects": false,
        "position": false,
        "spacings": false,
        "frame": false,
        "transform": false,
        "customCSS": false,
        "display": false,
        "attributes": false
      }
    },
    "controls": {
      "control_45dfa747e3": {
        "type": "panel",
        "name": "",
        "default": "",
        "label": "表示条件",
        "help": "",
        "child_of": "",
        "placement": "inspector",
        "group": "settings",
        "width": "100",
        "hide_if_not_selected": "false",
        "required": "false",
        "translate": "false",
        "save_in_meta": "false",
        "save_in_meta_name": "",
        "placeholder": "",
        "characters_limit": "",
        "icon": "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewbox=\"0 0 256 256\" fill=\"#dbea88\"><path d=\"M216,96V208a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V96a8,8,0,0,1,8-8H208A8,8,0,0,1,216,96Z\" opacity=\"0.2\"/><path d=\"M208,80H176V56a48,48,0,0,0-96,0V80H48A16,16,0,0,0,32,96V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V96A16,16,0,0,0,208,80ZM96,56a32,32,0,0,1,64,0V80H96ZM208,208H48V96H208V208Zm-68-56a12,12,0,1,1-12-12A12,12,0,0,1,140,152Z\"/></svg>",
        "initial_open": "true",
        "endpoint": "false"
      },
      "control_748837adb6": {
        "type": "select",
        "name": "restrict_target",
        "default": "all",
        "label": "表示対象",
        "help": "",
        "child_of": "",
        "placement": "inspector",
        "group": "settings",
        "width": "100",
        "hide_if_not_selected": "false",
        "required": "false",
        "translate": "false",
        "save_in_meta": "false",
        "save_in_meta_name": "",
        "placeholder": "",
        "characters_limit": "",
        "choices": [
          {
            "label": "全員に表示",
            "value": "all"
          },
          {
            "label": "ログインユーザーのみ",
            "value": "logged_in"
          },
          {
            "label": "特定ロールのみ",
            "value": "role"
          }
        ],
        "allow_null": "false",
        "multiple": "false",
        "output_format": ""
      },
      "control_5b8090ae5c": {
        "type": "checkbox",
        "name": "restrict_role",
        "default": [],
        "label": "対象ロール（表示対象が「特定ロール」の場合のみ・複数選択可）",
        "help": "「特定ロール」を選んだ場合のみ使用します。1つも選択しない場合は、ログイン済みの全ユーザーに表示されます。",
        "child_of": "",
        "placement": "inspector",
        "group": "settings",
        "width": "100",
        "hide_if_not_selected": "false",
        "required": "false",
        "translate": "false",
        "save_in_meta": "false",
        "save_in_meta_name": "",
        "placeholder": "",
        "characters_limit": "",
        "choices": [
          {
            "label": "管理者",
            "value": "administrator"
          },
          {
            "label": "編集者",
            "value": "editor"
          },
          {
            "label": "投稿者",
            "value": "author"
          },
          {
            "label": "購読者",
            "value": "subscriber"
          }
        ],
        "checked": "false",
        "alongside_text": "",
        "multiple": "true",
        "output_format": ""
      },
      "control_e7f355a46d": {
        "type": "panel",
        "name": "",
        "default": "",
        "label": "非表示時の案内",
        "help": "",
        "child_of": "",
        "placement": "inspector",
        "group": "settings",
        "width": "100",
        "hide_if_not_selected": "false",
        "required": "false",
        "translate": "false",
        "save_in_meta": "false",
        "save_in_meta_name": "",
        "placeholder": "",
        "characters_limit": "",
        "icon": "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewbox=\"0 0 256 256\" fill=\"#dbea88\"><path d=\"M216,96V208a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V96a8,8,0,0,1,8-8H208A8,8,0,0,1,216,96Z\" opacity=\"0.2\"/><path d=\"M208,80H176V56a48,48,0,0,0-96,0V80H48A16,16,0,0,0,32,96V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V96A16,16,0,0,0,208,80ZM96,56a32,32,0,0,1,64,0V80H96ZM208,208H48V96H208V208Zm-68-56a12,12,0,1,1-12-12A12,12,0,0,1,140,152Z\"/></svg>",
        "initial_open": "false",
        "endpoint": "false"
      },
      "control_2acb2609c1": {
        "type": "rich_text",
        "name": "restrict_message",
        "default": "",
        "label": "非表示時のメッセージ（任意）",
        "help": "太字やリンクなどの装飾が使えます。空の場合は既定文言が表示されます。",
        "child_of": "",
        "placement": "inspector",
        "group": "settings",
        "width": "100",
        "hide_if_not_selected": "false",
        "required": "false",
        "translate": "false",
        "save_in_meta": "false",
        "save_in_meta_name": "",
        "placeholder": "",
        "characters_limit": ""
      },
      "control_0421093ecb": {
        "type": "toggle",
        "name": "restrict_show_login_button",
        "default": "false",
        "label": "ログインボタンを表示する",
        "help": "",
        "child_of": "",
        "placement": "inspector",
        "group": "settings",
        "width": "100",
        "hide_if_not_selected": "false",
        "required": "false",
        "translate": "false",
        "save_in_meta": "false",
        "save_in_meta_name": "",
        "placeholder": "",
        "characters_limit": ""
      },
      "control_c5211349cd": {
        "type": "text",
        "name": "restrict_login_button_label",
        "default": "ログイン",
        "label": "ログインボタンのラベル",
        "help": "",
        "child_of": "",
        "placement": "inspector",
        "group": "settings",
        "width": "100",
        "hide_if_not_selected": "false",
        "required": "false",
        "translate": "false",
        "save_in_meta": "false",
        "save_in_meta_name": "",
        "placeholder": "ログイン",
        "characters_limit": ""
      },
      "control_39428069cd": {
        "type": "url",
        "name": "restrict_login_redirect_url",
        "default": "",
        "label": "ログインボタンのリンク先（任意）",
        "help": "空の場合は現在のページに戻ってくる標準のログインURLを自動生成します。",
        "child_of": "",
        "placement": "inspector",
        "group": "settings",
        "width": "100",
        "hide_if_not_selected": "false",
        "required": "false",
        "translate": "false",
        "save_in_meta": "false",
        "save_in_meta_name": "",
        "placeholder": "",
        "characters_limit": "",
        "posts_output_format": "",
        "multiple": "false"
      },
      "control_da9554f090": {
        "type": "rich_text",
        "name": "restrict_content",
        "default": "",
        "label": "表示する本文",
        "help": "条件を満たした訪問者にだけ表示される内容です。",
        "child_of": "",
        "placement": "content",
        "group": "settings",
        "width": "100",
        "hide_if_not_selected": "true",
        "required": "false",
        "translate": "false",
        "save_in_meta": "false",
        "save_in_meta_name": "",
        "placeholder": "",
        "characters_limit": ""
      }
    },
    "code": {
      "output_method": "php",
      "editor_html": "",
      "editor_callback": "",
      "frontend_html": "<?php\n$target = $attributes['restrict_target'] ?? 'all';\n$roles  = $attributes['restrict_role'] ?? array();\n$roles  = is_array( $roles ) ? $roles : array();\n$show   = true;\n\nif ( 'logged_in' === $target ) {\n\t$show = is_user_logged_in();\n} elseif ( 'role' === $target ) {\n\tif ( empty( $roles ) ) {\n\t\t$show = is_user_logged_in();\n\t} else {\n\t\t$show = false;\n\t\tif ( is_user_logged_in() ) {\n\t\t\tforeach ( $roles as $role ) {\n\t\t\t\tif ( current_user_can( $role ) ) {\n\t\t\t\t\t$show = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n$login_url = $attributes['restrict_login_redirect_url'] ?? '';\n$login_url = is_array( $login_url ) ? ( $login_url['url'] ?? '' ) : $login_url;\nif ( ! $login_url ) {\n\t$login_url = wp_login_url( get_permalink() );\n}\n$button_label = ! empty( $attributes['restrict_login_button_label'] ) ? $attributes['restrict_login_button_label'] : 'ログイン';\n?>\n<div class=\"restricted-area-block\">\n<?php if ( $show ) : ?>\n\t<div class=\"restricted-area-content\">\n\t\t<?php echo wp_kses_post( $attributes['restrict_content'] ?? '' ); ?>\n\t</div>\n<?php else : ?>\n\t<div class=\"restricted-area-message\">\n\t\t<?php if ( ! empty( $attributes['restrict_message'] ) ) : ?>\n\t\t\t<div class=\"restricted-area-message-text\"><?php echo wp_kses_post( $attributes['restrict_message'] ); ?></div>\n\t\t<?php else : ?>\n\t\t\t<div class=\"restricted-area-message-text\">このコンテンツを表示する権限がありません。</div>\n\t\t<?php endif; ?>\n\t\t<?php if ( ! empty( $attributes['restrict_show_login_button'] ) ) : ?>\n\t\t\t<a class=\"restricted-area-login-btn\" href=\"<?php echo esc_url( $login_url ); ?>\"><?php echo esc_html( $button_label ); ?></a>\n\t\t<?php endif; ?>\n\t</div>\n<?php endif; ?>\n</div><style>\n.restricted-area-block, .restricted-area-block * { box-sizing: border-box; }\n.restricted-area-content {\n\tmargin: 20px 0; padding: 20px 24px;\n\tborder: 1.5px solid rgba(0,210,211,0.35); border-radius: 8px;\n}\n.restricted-area-message {\n\tbackground: #111622; color: #a8a8c0; border-radius: 8px;\n\tpadding: 20px 24px; margin: 20px 0; font-size: 14px; text-align: center;\n}\n.restricted-area-message-text { margin: 0 0 12px !important; line-height: 1.7; }\n.restricted-area-message-text:last-child { margin-bottom: 0 !important; }\n.restricted-area-message-text a { color: #00d2d3; }\n.restricted-area-login-btn {\n\tdisplay: inline-block; background: #00d2d3; color: #111622 !important;\n\tfont-weight: 700; text-decoration: none !important; padding: 10px 24px;\n\tborder-radius: 6px; font-size: 14px; transition: background 0.2s ease;\n}\n.restricted-area-login-btn:hover { background: #FAC775; }\n\n@media (max-width: 680px) {\n\t.restricted-area-content { padding: 16px 18px; }\n\t.restricted-area-message { padding: 16px 18px; }\n}\n@media (max-width: 480px) {\n\t.restricted-area-content { padding: 14px 16px; }\n\t.restricted-area-message { padding: 14px 16px; font-size: 13px; }\n\t.restricted-area-login-btn { display: block; width: 100%; }\n}\n</style>\n<script>\ndocument.querySelectorAll('.restricted-area-block').forEach(function (block) {\n\tif (block.dataset.bound) return;\n\tblock.dataset.bound = 'true';\n\n\tvar inEditor = document.body.classList.contains('block-editor-iframe__body') ||\n\t\tdocument.body.classList.contains('editor-styles-wrapper') ||\n\t\tdocument.body.classList.contains('wp-admin');\n\tif (inEditor) {\n\t\tblock.querySelectorAll('a[href]').forEach(function (a) {\n\t\t\ta.addEventListener('click', function (e) { e.preventDefault(); });\n\t\t});\n\t}\n});\n</script>",
      "frontend_callback": "",
      "show_preview": "always",
      "single_output": true
    },
    "style": {
      "block": "",
      "editor": ""
    },
    "script": {
      "view": ""
    },
    "styles": [],
    "condition": [],
    "edit_url": null,
    "provide_context_to_blocks": "",
    "custom_context_slug": "",
    "allowed_blocks": "",
    "ancestor": ""
  }
]