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 Archives block alignment and custom class bugs #9696

Merged
merged 1 commit into from
Sep 12, 2018
Merged

Fix Archives block alignment and custom class bugs #9696

merged 1 commit into from
Sep 12, 2018

Conversation

ZebulanStanphill
Copy link
Member

Description

This PR fixes two issues:

  • The Archives block uses an alignnone class when no alignment is set, which is inconsistent with other blocks.
  • Custom class names do not work with the Archives block.

It also contains some minor code cleanup, reorganizing attributes alphabetically and using Array.prototype.includes to check for valid alignments (which is something the Latest Comments block already does), rather than the more verbose and harder-to-read series of ||s.

@ZebulanStanphill
Copy link
Member Author

I can't figure out what is going wrong with the tests. Any ideas?

@ZebulanStanphill
Copy link
Member Author

Fixed the tests. Thanks for the help, @aduth! 🙂

@ZebulanStanphill
Copy link
Member Author

Squashed and rebased. Ready for review.

'align' => array(
'type' => 'string',
),
'className' => array(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not certain declaring this one is necessary here because there's a hook adding this attribute. Though one could think the hook is only declared on JavaScript which means nothing guarantees that it's available in PHP (which hopefully the server-side awareness work should resolve)

Copy link
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 Thanks for the tweaks

@youknowriad youknowriad added this to the 3.9 milestone Sep 12, 2018
@youknowriad youknowriad added the [Feature] Blocks Overall functionality of blocks label Sep 12, 2018
@youknowriad youknowriad merged commit 77ff8e6 into WordPress:master Sep 12, 2018
@ZebulanStanphill ZebulanStanphill deleted the fix/archives-block-alignment-and-custom-classes branch September 12, 2018 13:03
@bartclaeys
Copy link

I am still having trouble with the image block. <figure> class alignnone is not being applied. Neither wp-caption-text on <figcaption>. For backward compatibility, these classes should be added.

screen shot 2018-11-05 at 2 32 08 pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Blocks Overall functionality of blocks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants