Skip to content
This repository has been archived by the owner on Sep 16, 2019. It is now read-only.

Updated Action Hooks and Classes for Wordpress Coding Standards #298

Merged
merged 4 commits into from
Apr 9, 2015
Merged

Updated Action Hooks and Classes for Wordpress Coding Standards #298

merged 4 commits into from
Apr 9, 2015

Conversation

joshrathke
Copy link
Contributor

Also fixed a couple “yoda condition” issues to make unit testing pass.

Josh Rathke added 3 commits April 8, 2015 14:42
Also fixed a couple “yoda condition” issues to make unit testing pass.
Just added a reminder for people to change the status badge to point to
their specific repository unit test.

function display_element( $element, &$children_elements, $max_depth, $depth = 0, $args, &$output ) {
$element->has_children = ! empty( $children_elements[ $element->ID ] );
$element->classes[] = ( $element->current || $element->current_item_ancestor ) ? 'active' : '';
$element->classes[] = ( $element->has_children && $max_depth !== 1 ) ? 'has-submenu' : '';
$element->classes[] = ( 1 !== $element->has_children && $max_depth ) ? 'has-submenu' : '';
Copy link
Contributor

Choose a reason for hiding this comment

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

This change seems wrong, previously it was
$element->has_children && $max_depth !== 1
and now it is
1 !== $element->has_children && $max_depth
shouldn't it rather be
$element->has_children && 1 !== $max_depth
?

@Aetles
Copy link
Contributor

Aetles commented Apr 8, 2015

Also, and I feel like I am nitpicking here, but if we are to follow coding standards then The WordPress Naming Conventions say this about naming classes:

Class names should use capitalized words separated by underscores.

Also fixed an error in menu-walker.php and offcanvas-walker.php
@joshrathke
Copy link
Contributor Author

@Aetles you were totally right. I completely missed that in the menu walkers. It had actually happened in menu-walker.php as well, but I went ahead and changed it. Both are now fixed and read:

$element->has_children && 1 !== $max_depth

Also thanks for reminding me of the true WP Standards definition for classes. I don't know why I was under the impression that it Classes were to be camel-case. Either way, it should all be changed now. I think I hit all the classes, but might need to have a double check on that.

The only thing that remains in question in my mind would be the text domain. WordPress doesn't seem to have a standard for the text-domain. However in the I18n Documentation found here it does state the following under the text domain section:

If you're translating a plugin or a theme, you'll need to use a text domain to denote all text belonging to that plugin. This increases portability and plays better with already existing WordPress tools. The text domain must match the “slug” of the plugin.

So I guess my last question is if we need to change the FoundationPress text domain to foundationpress, just to go the extra mile. I don't believe capital letters are ever translated into any slug.

@Aetles
Copy link
Contributor

Aetles commented Apr 9, 2015

Great! About the text domain: I'd vote for changing FoundationPress to foundationpress as that is more "slug-like".

@joshrathke
Copy link
Contributor Author

@olefredrik What do you think about the text domain change?

olefredrik added a commit that referenced this pull request Apr 9, 2015
Updated Action Hooks and Classes for Wordpress Coding Standards
@olefredrik olefredrik merged commit 4f095f2 into olefredrik:master Apr 9, 2015
@olefredrik
Copy link
Owner

I agree that it could be okay to change the text-domain to foundationpress, as long as this change does not affect any existing translations (I see no reason why it should). In all cases, the FoundationPress repository is now build passing, due to your great contributions. Well done, guys! You are awesome!

@Aetles Aetles mentioned this pull request Apr 27, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants