From dd9abd974f3e898ef10d4cc51e3bb5b7d1930136 Mon Sep 17 00:00:00 2001 From: Ari Stathopoulos Date: Wed, 21 Sep 2022 14:53:24 +0300 Subject: [PATCH] Add initial PHP implementation & filters for form action & method --- lib/blocks.php | 1 + packages/block-library/src/form/block.json | 12 +++- packages/block-library/src/form/index.php | 72 +++++++++++++++++++ .../block-library/src/input-field/edit.js | 1 + 4 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 packages/block-library/src/form/index.php diff --git a/lib/blocks.php b/lib/blocks.php index 842ff6a6ec093..8b008e5a989ff 100644 --- a/lib/blocks.php +++ b/lib/blocks.php @@ -65,6 +65,7 @@ function gutenberg_reregister_core_block_types() { 'comments-title.php' => 'core/comments-title', 'comments.php' => 'core/comments', 'file.php' => 'core/file', + 'form.php' => 'core/form', 'home-link.php' => 'core/home-link', 'image.php' => 'core/image', 'gallery.php' => 'core/gallery', diff --git a/packages/block-library/src/form/block.json b/packages/block-library/src/form/block.json index b9bdd98d5f619..d3562cf72d84a 100644 --- a/packages/block-library/src/form/block.json +++ b/packages/block-library/src/form/block.json @@ -6,5 +6,15 @@ "category": "common", "description": "A form.", "keywords": [ "container", "wrapper", "row", "section" ], - "textdomain": "default" + "textdomain": "default", + "attributes": { + "action": { + "type": "string", + "default": "#" + }, + "method": { + "type": "string", + "default": "get" + } + } } diff --git a/packages/block-library/src/form/index.php b/packages/block-library/src/form/index.php new file mode 100644 index 0000000000000..b17c6ea50135c --- /dev/null +++ b/packages/block-library/src/form/index.php @@ -0,0 +1,72 @@ + 'render_block_core_form', + ) + ); +} +add_action( 'init', 'register_block_core_form' ); diff --git a/packages/block-library/src/input-field/edit.js b/packages/block-library/src/input-field/edit.js index f9369888e5405..b3b26a88dfba9 100644 --- a/packages/block-library/src/input-field/edit.js +++ b/packages/block-library/src/input-field/edit.js @@ -10,6 +10,7 @@ import { import { PanelBody, CustomSelectControl, + TextControl, CheckboxControl, } from '@wordpress/components'; import { useRef } from '@wordpress/element';