-
Notifications
You must be signed in to change notification settings - Fork 801
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
Make input fields and "push button" class filterable #7614
Conversation
* | ||
* @param string $class Additional CSS classes for button attribute. | ||
*/ | ||
$submit_button_class = apply_filters( 'grunion_contact_form_submit_button_class', $submit_button_class ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's go with jetpack_contact_form_submit_button_class
for the name here
@@ -2553,6 +2565,16 @@ function render() { | |||
$field_required = $this->get_attribute( 'required' ); | |||
$placeholder = $this->get_attribute( 'placeholder' ); | |||
$class = $this->get_attribute( 'class' ); | |||
|
|||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the block above has already been documented, this can just be
/** This filter is already documented in modules/contact-form/grunion-contact-form.php */
* Add @SInCE 5.3.0 param in code block; * Change `grunion_contact_form_submit_button_class` to `jetpack_contact_form_submit_button_class`;
@dereksmart changed :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for iterating with us! I have added several comments, please take a look.
* Filter the contact form submit button class attribute. | ||
* | ||
* @module contact-form | ||
* @since 5.3.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some time has passed since this PR has been submitted, so please edit this to be 5.5.0
instead - this will only make it in the shipped code in 5.5.0.
@@ -2550,7 +2563,10 @@ function render() { | |||
$field_label = $this->get_attribute( 'label' ); | |||
$field_required = $this->get_attribute( 'required' ); | |||
$placeholder = $this->get_attribute( 'placeholder' ); | |||
$class = 'date' === $field_type ? 'jp-contact-form-date' : $this->get_attribute( 'class' ); | |||
$class = 'date' === $field_type ? 'jp-contact-form-date' : $this->get_attribute( 'class' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation is off here, please use two tabs.
$class = 'date' === $field_type ? 'jp-contact-form-date' : $this->get_attribute( 'class' ); | ||
$class = 'date' === $field_type ? 'jp-contact-form-date' : $this->get_attribute( 'class' ); | ||
|
||
/** This filter is already documented in modules/contact-form/grunion-contact-form.php */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, but I think you'll need to bring back the doc block here. I think @dereksmart initially thought that it was the same filter, and it's not. Also please use consistent namespacing. Would jetpack_contact_form_input_class
work here instead?
@@ -1542,7 +1542,20 @@ static function parse( $attributes, $content ) { | |||
$r .= "<form action='" . esc_url( $url ) . "' method='post' class='contact-form commentsblock'>\n"; | |||
$r .= $form->body; | |||
$r .= "\t<p class='contact-submit'>\n"; | |||
$r .= "\t\t<input type='submit' value='" . esc_attr( $form->get_attribute( 'submit_button_text' ) ) . "' class='pushbutton-wide'/>\n"; | |||
|
|||
$submit_button_class = 'pushbutton-wide'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a real nitpicky suggestion, but you could have avoided adding that line by just passing pushbutton-wide
as a default to the apply_filters
call down there.
* Removed var for `pushbutton-wide`. Now it goes straight on apply_filters; * Changed from 5.3.0 to 5.5.0 on PHPDoc block; * Indentation fix; * Removed unecessary PHPDoc block.
@dereksmart @zinigor changed :) |
Thanks for making changes, looks much better now! Only two things that are need attention now are:
|
@jimmyandrade Wanted to see if you missed the comment from @zinigor above. Can you please take a quick look and update the PR? Thanks in advance! |
@keoshi sorry for the delay. I'm gonna do this 👍 :) |
* Adds the docblock for the second filter; * Make filter namespacing consistent, using the same prefix (jetpack_) in both of them.
jetpacl -> jetpack
Thank you, @jimmyandrade — pinging @zinigor so he can take another look at your PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good now. 🚢
Filters were updated to address the issues.
This is automated check which relies on Generated by 🚫 dangerJS |
Filters now include a since comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks good now!
* Readme: add boilerplate for next release, 6.6 * Add 6.5 to the changelog.txt file * Set boilerplate testing list for 6.6 * Readme: update stable tag to 6.5 * Add bullets to 6.5 changelog items * Readme: add link to previous changelogs This will help folks who want to know more about past releases, while keeping the readme.txt short so as to not overwhelm translators and site owners only looking for information about the last release. * Changelog: add information at the top of the changelog file. * Changelog: add #10054 * Changelog: add #10078 * Changelog: add #10079 * Changelog: add #10064 * Changelog: add #10094 * Changelog: add #10096 * Testing list: add more information based on #10087 * Changelog: add #9847 * Changelog: add #10084 * Changelog: add #9918 * Changelog: add #7614 * Changelog: add #10116 * Changelog: add #10108 * Changelog: add #10041 * Changelog: add #10121 * Changelog: add #10134 * Changelog: add #10130 * Changelog: add #10109 * changelog: add #10137 * changelog: add #9952 * changelog: add #10120 * changelog: add #10162 * Changelog: add #10163 * Changelog: add #10092 * changelog: add #10156 * Changelog: add #10154 * changelog: add #10122 * Changelog: add #10101 * changelog: add #10105 * changelog: add #10190 * Changelog: add #10196 * changelog: add #10152 * Changelog: add #10153 * Testing list: add more details to Site Verification testing steps. @see #10143 (comment) * changelog: add #10194 * Changelog: add #10193
Fixes #7613
Changes proposed in this Pull Request:
class
attribute of inputs and buttons filterable, so that developers can add the classes without having to hack the WordPress core or CSS framework.Proposed changelog entry for your changes:
grunion_contact_form_submit_button_class
andgrunion_contact_form_input_class
filters to customize theclass
attributes of inputs and buttons in Contact Form.