form オブジェクト
Liquid テンプレート内でフォーム送信時の入力値やバリデーションエラーにアクセスするオブジェクト。contact フォーム、顧客登録、住所管理、記事コメントなど複数のフォーム種別に対応する。
仕様
341 行 / json{
"access": {
"global": false,
"parents": [],
"template": []
},
"deprecated": false,
"deprecation_reason": "",
"description": "",
"properties": [
{
"deprecated": false,
"deprecation_reason": "",
"description": "If there are no errors, then `nil` is returned.\n\n> Tip:\n> You can apply the [`default_errors` filter](/docs/api/liquid/filters/default_errors) to `form.errors` to output default\n> error messages without having to loop through the array.",
"examples": [],
"return_type": [
{
"type": "form_errors",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "Any errors from the form.",
"name": "errors"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "This property is exclusive to the [`customer_address` form](/docs/api/liquid/tags/form#form-customer_address).",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The first address line associated with the address.",
"name": "address1"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "This property is exclusive to the [`customer_address` form](/docs/api/liquid/tags/form#form-customer_address).",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The second address line associated with the address.",
"name": "address2"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "This property is exclusive to the [`new_comment` form](/docs/api/liquid/tags/form#form-new_comment).",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The name of the author of the article comment.",
"name": "author"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "This property is exclusive to the [`contact`](/docs/api/liquid/tags/form#form-contact) and [`new_comment`](/docs/api/liquid/tags/form#form-new_comment)\nforms.",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The content of the contact submission or article comment.",
"name": "body"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "This property is exclusive to the [`customer_address` form](/docs/api/liquid/tags/form#form-customer_address).",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The city associated with the address.",
"name": "city"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "This property is exclusive to the [`customer_address` form](/docs/api/liquid/tags/form#form-customer_address).",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The company associated with the address.",
"name": "company"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "This property is exclusive to the [`customer_address` form](/docs/api/liquid/tags/form#form-customer_address).",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The country associated with the address.",
"name": "country"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "This property is exclusive to the following forms:\n\n- [`contact`](/docs/api/liquid/tags/form#form-contact)\n- [`create_customer`](/docs/api/liquid/tags/form#form-create_customer)\n- [`customer`](/docs/api/liquid/tags/form#form-customer)\n- [`customer_login`](/docs/api/liquid/tags/form#form-customer_login)\n- [`new_comment`](/docs/api/liquid/tags/form#form-new_comment)\n- [`recover_customer_password`](/docs/api/liquid/tags/form#form-recover_customer_password)\n- [`product`](/docs/api/liquid/tags/form#form-product)",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The email associated with the form.",
"name": "email"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "This property is exclusive to the [`create_customer`](/docs/api/liquid/tags/form#form-create_customer) and\n[`customer_address`](/docs/api/liquid/tags/form#form-customer_address) forms.",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The first name associated with the customer or address.",
"name": "first_name"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The ID of the form.",
"name": "id"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "This property is exclusive to the [`create_customer`](/docs/api/liquid/tags/form#form-create_customer) and\n[`customer_address`](/docs/api/liquid/tags/form#form-customer_address) forms.",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The last name associated with the customer or address.",
"name": "last_name"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "This property is exclusive to the [`customer_login` form](/docs/api/liquid/tags/form#form-customer_login).",
"examples": [],
"return_type": [
{
"type": "boolean",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "Returns `true`.",
"name": "password_needed"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "This property is exclusive to the [`customer_address` form](/docs/api/liquid/tags/form#form-customer_address).",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The phone number associated with the address.",
"name": "phone"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "> Note:\n> The [`customer_address` form](/docs/api/liquid/tags/form#form-customer_address) always returns `true`.",
"examples": [],
"return_type": [
{
"type": "boolean",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "Returns `true` if the form was submitted successfully. Returns `false` if there were errors.",
"name": "posted_successfully?"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "This property is exclusive to the [`customer_address` form](/docs/api/liquid/tags/form#form-customer_address).",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The province associated with the address.",
"name": "province"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "This property is exclusive to the [`customer_address` form](/docs/api/liquid/tags/form#form-customer_address).",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "Renders an HTML checkbox that can submit the address as the customer's default address.",
"name": "set_as_default_checkbox"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "This property is exclusive to the [`product` form](/docs/api/liquid/tags/form#form-product).",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The nickname of the gift card recipient.",
"name": "name"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "This property is exclusive to the [`product` form](/docs/api/liquid/tags/form#form-product).",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The personalized message intended for the recipient.",
"name": "message"
},
{
"deprecated": false,
"deprecation_reason": "",
"description": "This property is exclusive to the [`customer_address` form](/docs/api/liquid/tags/form#form-customer_address).",
"examples": [],
"return_type": [
{
"type": "string",
"name": "",
"description": "",
"array_value": ""
}
],
"summary": "The zip or postal code associated with the address.",
"name": "zip"
}
],
"summary": "Information about a form created by a [`form` tag](/docs/api/liquid/tags/form).",
"name": "form",
"examples": [],
"json_data": {
"path": "",
"handle": "",
"data_from_file": "{\"address1\":\"12 Phoenix Feather Alley\",\"address2\":\"1\",\"author\":null,\"body\":null,\"city\":\"Calgary\",\"company\":null,\"country\":\"Canada\",\"email\":null,\"errors\":null,\"first_name\":\"Cornelius\",\"id\":\"new\",\"last_name\":\"Potionmaker\",\"password_needed?\":false,\"phone\":\"44 131 496 0905\",\"posted_successfully?\":true,\"province\":\"Alberta\",\"set_as_default_checkbox\":\"<input type='checkbox' id='address_default_address_new' name='address[default]' value='1'>\",\"zip\":\"T1X 0L4\"}"
},
"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` で有無を判定したうえで、このオブジェクトで実際のボタンを表示する。