{
  "name": "bricks/popup/attributes",
  "kind": "filter",
  "url": "https://academy.bricksbuilder.io/developer/hooks/filters/bricks-popup-attributes/",
  "scraped_at": "2026-08-29",
  "hook_name": "bricks/popup/attributes",
  "description": {
    "en": "Filters the HTML attributes of the popup container. This allows you to add custom classes, data attributes, or other attributes to the popup element.",
    "zh": "筛选弹出窗口容器的 HTML 属性。允许你向弹出窗口元素添加自定义类、data 属性或其他属性。"
  },
  "parameters": [
    {
      "name": "attributes",
      "type": "array",
      "type_zh": null,
      "description": {
        "en": "Array of HTML attributes (e.g., class , data-popup-id ).",
        "zh": "HTML 属性数组（例如 class、data-popup-id）。"
      }
    },
    {
      "name": "popup_id",
      "type": "int",
      "type_zh": null,
      "description": {
        "en": "The ID of the popup template.",
        "zh": "弹窗模板的 ID。"
      }
    }
  ],
  "example_usage": "add_filter( 'bricks/popup/attributes', function( $attributes, $popup_id ) {\n    // Example: Add a custom class to a specific popup\n    if ( $popup_id === 1234 ) {\n        $attributes['class'][] = 'my-custom-popup-class';\n        $attributes['data-custom-attr'] = 'value';\n    }\n\n\n    return $attributes;\n}, 10, 2 );"
}