block オブジェクト
セクション内の再利用可能なコンテンツモジュール(ブロック)の ID、タイプ、設定にアクセスするオブジェクト。セクションスキーマで定義した最大50個のブロックにそれぞれ対応する。
仕様
90 行 / json{
"access": {
"global": false,
"parents": [
{
"object": "section",
"property": "blocks"
}
],
"template": []
},
"deprecated": false,
"deprecation_reason": "",
"description": "Sections and blocks are reusable modules of content that make up [templates](/themes/architecture/templates).\n\nYou can include a maxiumum of 50 blocks in a section. To learn more about using blocks, refer to the [Building with sections and blocks](/docs/themes/best-practices/templates-sections-blocks).",
"properties": [
{
"deprecated": false,
"deprecation_reason": "",
"description": "The ID is dynamically generated by Shopify and is subject to change. You should avoid relying on a literal value of this ID.",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The ID of the block.",
"name": "id"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "To learn about how to access settings, refer to [Access settings](/themes/architecture/settings#access-settings). To learn which input settings can be applied to the `type` property within settings, refer to [Input settings](/themes/architecture/settings/input-settings).",
"examples": [],
"return_type": [
{
"type": "untyped",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The [settings](/themes/architecture/sections/section-schema#blocks) of the block.",
"name": "settings"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "The type is a free-form string that's defined in the [block's schema](/themes/architecture/sections/section-schema#blocks).\nYou can use the type as an identifier. For example, you might display different markup based on the block type.",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The type of the block.",
"name": "type"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "The theme editor's [JavaScript API](/themes/best-practices/editor/integrate-sections-and-blocks#section-and-block-javascript-events)\nuses the data attributes to identify blocks and listen for events. No value for `block.shopify_attributes` is returned\noutside the theme editor.",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The data attributes for the block for use in the theme editor.",
"name": "shopify_attributes"
}
],
"summary": "The content and settings of a [section block](/themes/architecture/sections/section-schema#blocks).",
"name": "block",
"examples": [],
"json_data": {
"path": "",
"handle": "",
"data_from_file": "{\"id\":\"column1\",\"settings\":\"array\",\"shopify_attributes\":\"data-shopify-editor-block=\\\"{\\\"id\\\":\\\"column1\\\",\\\"type\\\":\\\"column\\\"}\\\"\",\"type\":\"column\"}"
},
"return_type": []
}出典・ライセンス
- Repository:
- https://github.com/Shopify/theme-liquid-docs
- License:
- MIT
このコードは Shopify 著作の MIT ライセンスソースです。 原本の著作権は Shopify が保有します。日本語訳は ALSEL によるものです。
関連項目
content_for_header オブジェクト
Shopify が必要とするスクリプト(分析・チェックアウト・言語設定など)をすべて動的に出力するオブジェクト。theme.liquid の <head> タグ内に埋め込む必須要素。
metaobjects オブジェクト
ストア全体のメタオブジェクト定義にアクセスするグローバルオブジェクト。個別のメタオブジェクトはタイプとハンドルで参照でき、メタオブジェクト定義のエントリをループで反復処理できる。
additional_checkout_buttons オブジェクト
PayPal Express Checkout など、オフサイト決済に対応した外部決済プロバイダーがストアに設定されているかを真偽値で返す。`content_for_additional_checkout_buttons` と組み合わせて、該当するチェックアウトボタンを条件付きで表示する。
canonical_url オブジェクト
現在のページの正規 URL を取得するオブジェクト。Google などの検索エンジンに対してどのページ版が正規であるかを指定するために使用する。
content_for_index オブジェクト
ホームページに表示するセクションの内容を動的に返すオブジェクト。Liquid インデックステンプレートで必ず使用する。
content_for_additional_checkout_buttons オブジェクト
PayPal、Apple Pay、Google Pay など複数の決済プロバイダが有効になっているとき、その決済ボタンを HTML として出力するオブジェクト。`additional_checkout_buttons` で有無を判定したうえで、このオブジェクトで実際のボタンを表示する。