📄 原始资料 | 展开查看原始 JSON(conditions.json)
{
"type": "array",
"description": "Element display conditions. Controls whether the element renders. Outer array is OR groups, inner arrays are AND items. The element renders if any OR group evaluates to true. Extensible via bricks/conditions/groups and bricks/conditions/options filters.",
"items": {
"type": "array",
"description": "AND group: all items in this array must be true for the group to match",
"items": {
"type": "object",
"description": "A single display condition that evaluates to true or false. Combined with other items in AND groups, then OR across groups.",
"properties": {
"id": {
"type": [
"string",
"integer"
],
"description": "Unique identifier for this condition",
"descriptionZh": "此条件的唯一标识符。"
},
"key": {
"type": "string",
"description": "Condition type. General: browser, current_url, date, datetime, dynamic_data, featured_image, operating_system, referer, time, weekday. Post: post_author, post_date, post_id, post_parent, post_status, post_title. User: user_id, user_logged_in, user_registered, user_role. WooCommerce: woo_product_category, woo_product_featured, woo_product_new, woo_product_purchased_by_user, woo_product_rating, woo_product_sale, woo_product_sold_individually, woo_product_stock_management, woo_product_stock_quantity, woo_product_stock_status, woo_product_tag, woo_product_type. Extensible via bricks/conditions/options filter.",
"enum": [
"browser",
"current_url",
"date",
"datetime",
"dynamic_data",
"featured_image",
"operating_system",
"post_author",
"post_date",
"post_id",
"post_parent",
"post_status",
"post_title",
"referer",
"time",
"user_id",
"user_logged_in",
"user_registered",
"user_role",
"weekday",
"woo_product_category",
"woo_product_featured",
"woo_product_new",
"woo_product_purchased_by_user",
"woo_product_rating",
"woo_product_sale",
"woo_product_sold_individually",
"woo_product_stock_management",
"woo_product_stock_quantity",
"woo_product_stock_status",
"woo_product_tag",
"woo_product_type"
],
"descriptionZh": "条件类型。通用:browser(浏览器)、current_url(当前 URL)、date(日期)、datetime(日期时间)、dynamic_data(动态数据)、featured_image(特色图像)、operating_system(操作系统)、referer(来源)、time(时间)、weekday(星期几)。文章:post_author(文章作者)、post_date(文章日期)、post_id(文章 ID)、post_parent(父文章)、post_status(文章状态)、post_type(文章类型)等。"
},
"compare": {
"type": "string",
"description": "Comparison operator. ==: equal, !=: not equal, >=: greater or equal, <=: less or equal, >: greater, <: less, contains: string contains, contains_not: string does not contain, empty: value is empty (no value field needed), empty_not: value is not empty (no value field needed). Available operators vary by condition key.",
"enum": [
"==",
"!=",
">=",
"<=",
">",
"<",
"contains",
"contains_not",
"empty",
"empty_not"
],
"descriptionZh": "比较运算符。==:等于,!=:不等于,>=:大于等于,<=:小于等于,>:大于,<:小于,contains:字符串包含,contains_not:字符串不包含,empty:值为空(无需提供 value),empty_not:值非空。"
},
"value": {
"description": "Value to compare against. Not required when compare is empty or empty_not.",
"oneOf": [
{
"type": [
"string",
"number",
"integer",
"boolean",
"null"
]
},
{
"type": "object"
},
{
"type": "array"
}
],
"descriptionZh": "要与之比较的值。当 compare 为 empty 或 empty_not 时无需提供。"
},
"dynamic_data": {
"type": "string",
"description": "Dynamic data tag to use as the value source (e.g. Bricks Schema 中文文档:conditions)",
"descriptionZh": "用作值来源的动态数据标签(例如 Bricks Schema 中文文档:conditions)。"
}
},
"additionalProperties": false,
"descriptionZh": "单个显示条件,评估为 true 或 false。在 AND 组中与其他项组合,然后在 OR 组之间组合。"
},
"descriptionZh": "AND 组:本数组中的所有项都必须为 true,组才匹配。"
},
"descriptionZh": "元素显示条件。控制元素是否渲染。外层数组是 OR 组,内层数组是 AND 项。当任意 OR 组评估为 true 时,元素渲染。可通过 bricks/conditions/register 扩展。"
}
前言
元素显示条件。控制元素是否渲染。外层数组是 OR 组,内层数组是 AND 项。当任意 OR 组评估为 true 时,元素渲染。可通过 bricks/conditions/register 扩展。
基本信息
- 类型:
array
补充说明
更多细节可参考 Bricks 官方 Academy 文档。