-
Notifications
You must be signed in to change notification settings - Fork 385
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
Hide AMP Layout control if block does not have specified setting #5573
Hide AMP Layout control if block does not have specified setting #5573
Conversation
Plugin builds for 4ce49d8 are ready 🛎️!
|
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.
Leaving the same comment here as on the other similar PR.
* @param {Object} props Props. | ||
* | ||
* @return {ReactElement} Element. | ||
*/ | ||
const AmpLayoutControl = ( props ) => { | ||
const { name, attributes: { ampLayout }, setAttributes } = props; | ||
|
||
if ( ! ampLayout ) { |
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.
See my comment here https://github.com/ampproject/amp-wp/pull/5574/files#r518529646. We probably want this check to be for undefined instead of false.
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.
Good catch. Addressed in 5993490.
762af24
to
5993490
Compare
Codecov Report
@@ Coverage Diff @@
## develop #5573 +/- ##
=============================================
+ Coverage 73.41% 73.62% +0.20%
- Complexity 5384 5424 +40
=============================================
Files 187 187
Lines 16236 16364 +128
=============================================
+ Hits 11920 12048 +128
Misses 4316 4316
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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 tests well. However, there's one additional change that would be worthwhile: could you add a warning notice to precede the AMP Layout setting that says:
The AMP Layout setting is deprecated and is slated for removal. Please report if you need it.
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.
Looks great.
const { name, attributes: { ampLayout }, setAttributes } = props; | ||
|
||
if ( undefined === ampLayout ) { |
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.
Per https://wordpress.org/support/topic/seeing-a-the-amp-layout-setting-is-deprecated-on-images/ this may need to be changed to:
if ( undefined === ampLayout || '' === ampLayout ) {
Summary
Fixes #4554.
When the control is displayed, a deprecated warning notice is shown:
Checklist