Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.

Support Customize Menus #55

Merged
merged 24 commits into from
Jul 6, 2016
Merged

Support Customize Menus #55

merged 24 commits into from
Jul 6, 2016

Conversation

valendesigns
Copy link
Contributor

Fixes #2

@valendesigns
Copy link
Contributor Author

@miina & @westonruter I'm thinking we may need to handle the transition to publish in this PR before it's ready for merge. Thought?

@westonruter
Copy link
Contributor

@valendesigns transition to publish in what way?

$manager->snapshot()->is_preview = true;

$menu_items = array();
$menu_items[] = $this->manager->value_as_wp_post_nav_menu_item(
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can avoid duplicating the WP_Customize_Nav_Menu_Item_Setting::value_as_wp_post_nav_menu_item() method here by doing:

$setting_id = sprintf( 'nav_menu_item[%d]', static::MENU_ID );
$nav_menu_item = new WP_Customize_Nav_Menu_Item_Setting( $this->customize_manager, $setting_id, array(
    value: array( /* ... */ )
) );
$menu_items[] = $nav_menu_item-> value_as_wp_post_nav_menu_item();

@westonruter
Copy link
Contributor

westonruter commented Jul 5, 2016

@valendesigns @miina I believe this will reduce the overall amount of code and re-use what is in WP_Customzie_Nav_Menus already: #56

With those changes merged into this PR, the resulting diff is much smaller: develop...bugfix/saving-menus-issue_3

I tried creating a new nav menu, assigning it to a nav menu location, and adding new nav menu items to it. I created the snapshot and loaded it on the frontend in both an authenticated and incognito window, and the snapshotted menu and nav menu items appeared as expected for me in both cases.

Please review.

@coveralls
Copy link

Coverage Status

Coverage decreased (-1.6%) to 91.031% when pulling 310b365 on bugfix/saving-menus-issue_2 into cb45595 on develop.

@coveralls
Copy link

coveralls commented Jul 5, 2016

Coverage Status

Coverage decreased (-1.6%) to 91.031% when pulling 310b365 on bugfix/saving-menus-issue_2 into cb45595 on develop.

@westonruter
Copy link
Contributor

I think this is finally ready! 😂

@coveralls
Copy link

coveralls commented Jul 6, 2016

Coverage Status

Coverage decreased (-0.6%) to 92.105% when pulling d5e0bbc on bugfix/saving-menus-issue_2 into cb45595 on develop.

@westonruter westonruter merged commit 5dd4ed9 into develop Jul 6, 2016
@westonruter westonruter deleted the bugfix/saving-menus-issue_2 branch July 6, 2016 17:59
@westonruter westonruter modified the milestone: 0.5.0 Aug 12, 2016
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.

None yet

4 participants