@@ -18,6 +18,7 @@ class Dataform extends Component
1818 * @param string|null $action Custom form action URL
1919 * @param string $method Form method (post, put, etc.)
2020 * @param bool $focusOnFirstField Whether to focus on the first field when form loads
21+ * @param bool|null $showCancelButton Override for the CRUD cancel button visibility
2122 */
2223 public function __construct (
2324 public string $ controller ,
@@ -30,6 +31,7 @@ public function __construct(
3031 public $ entry = null ,
3132 public ?Closure $ setup = null ,
3233 public bool $ focusOnFirstField = false ,
34+ public ?bool $ showCancelButton = null ,
3335 public bool $ formInsideCard = false ,
3436 public array $ saveActions = [],
3537 ) {
@@ -71,6 +73,10 @@ public function __construct(
7173 call_user_func ($ this ->setup , $ this ->crud , $ parentEntry );
7274 }
7375
76+ if (! is_null ($ showCancelButton )) {
77+ $ this ->crud ->setOperationSetting ('showCancelButton ' , $ showCancelButton );
78+ }
79+
7480 // Reset the active controller
7581 CrudManager::unsetActiveController ();
7682 }
0 commit comments