{
  "name": "bricks/element/form/datepicker_options",
  "kind": "filter",
  "url": "https://academy.bricksbuilder.io/developer/hooks/filters/bricks-element-form-datepicker_options/",
  "scraped_at": "2026-08-29",
  "hook_name": "bricks/element/form/datepicker_options",
  "description": {
    "en": "Filters the Flatpickr options for the datepicker field in the Form element. This allows you to customize the behavior of the date picker (e.g., disable specific dates, change the date format, set min/max dates).",
    "zh": "筛选自定义元素清单（Custom Elements）。使用此筛选器可向 Bricks 添加你自己的自定义元素。"
  },
  "parameters": [
    {
      "name": "datepicker_options",
      "type": "array",
      "type_zh": null,
      "description": {
        "en": "Array of Flatpickr options.",
        "zh": "Flatpickr 选项数组。"
      }
    },
    {
      "name": "element",
      "type": "object",
      "type_zh": null,
      "description": {
        "en": "The Form element instance.",
        "zh": "Form 元素实例。"
      }
    }
  ],
  "example_usage": "add_filter( 'bricks/element/form/datepicker_options', function( $datepicker_options, $element ) {\n    // Example: Disable weekends (Saturday and Sunday)\n    $datepicker_options['disable'] = [\n        function( $date ) {\n            // Return true to disable\n            return ( $date->format( 'N' ) >= 6 );\n        }\n    ];\n\n\n    // Example: Set minDate to today\n    $datepicker_options['minDate'] = 'today';\n\n\n    return $datepicker_options;\n}, 10, 2 );"
}