Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/cc 442 block default selected form #686

Merged
merged 10 commits into from
Oct 28, 2024
2 changes: 1 addition & 1 deletion build/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "constant-contact/single-contact-form",
"version": "2.6.0",
"version": "2.7.0",
"title": "Constant Contact: Single Form",
"category": "widgets",
"icon": "index-card",
Expand Down
2 changes: 1 addition & 1 deletion build/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-i18n'), 'version' => 'eede910bfcdc942469fc');
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-i18n'), 'version' => '016ddd1f8af4d033948d');
2 changes: 1 addition & 1 deletion build/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "constant-contact-forms",
"version": "2.6.1",
"version": "2.7.0",
"description": "",
"main": "build/index.js",
"engines": {
Expand All @@ -14,7 +14,7 @@
"dev": "wp-scripts start --output-path 'assets/js'",
"lint": "run-p lint:*",
"lint:css": "wp-scripts lint-style '**/*.scss'",
"lint:js": "wp-scripts lint-js",
"lint:js": "wp-scripts lint-js",
"packages-update": "wp-scripts packages-update",
"pot": "wp-pot --src './*.php --src './includes' --dest-file 'languages/constant-contact-forms.pot --domain 'constant-contact-forms'",
"plugin-zip": "wp-scripts plugin-zip",
Expand Down
2 changes: 1 addition & 1 deletion src/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "constant-contact/single-contact-form",
"version": "2.6.1",
"version": "2.7.0",
"title": "Constant Contact: Single Form",
"category": "widgets",
"icon": "index-card",
Expand Down
11 changes: 10 additions & 1 deletion src/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,16 @@ export default function Edit(props) {
formEntryObjs = theforms.map((form) => {
return {label: form.title.rendered, value: form.id};
});
const isDisabled = (formEntryObjs && formEntryObjs.length === 0);
formEntryObjs.unshift(
{
label: __('Select Form', 'constant-contact-forms'),
value: 0,
disabled: isDisabled,
}
)
}
let smMsg = (formEntryObjs && formEntryObjs.length > 1 ) ? __('Choose the form to display with the dropdown below.', 'constant-contact-forms' ) : __('Please create a Constant Contact Form.', 'constant-contact-forms');

return (
<div {...blockProps}>
Expand All @@ -51,7 +60,7 @@ export default function Edit(props) {
</div>
</div>
<div className="ctct-block-container--selection">
<small>{__('Choose the form to display with the dropdown below.', 'constant-contact-forms')}</small>
<small>{smMsg}</small>
<div className="ctct-block-container--component">
<SelectControl
label={__('Chosen form', 'constant-contact-forms')}
Expand Down