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

Commit 310b365

Browse files
committed
2 parents 6393ddd + cb45595 commit 310b365

4 files changed

+39
-14
lines changed

.travis.yml

-4
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ env:
1616
- WP_VERSION=trunk WP_MULTISITE=1
1717
- WP_VERSION=latest WP_MULTISITE=1
1818

19-
branches:
20-
only:
21-
- master
22-
2319
install:
2420
- export DEV_LIB_PATH=dev-lib
2521
- if [ ! -e "$DEV_LIB_PATH" ] && [ -L .travis.yml ]; then export DEV_LIB_PATH=$( dirname $( readlink .travis.yml ) ); fi

dev-lib

Submodule dev-lib updated 1 file

php/class-customize-snapshot-manager.php

+34-2
Original file line numberDiff line numberDiff line change
@@ -1002,11 +1002,44 @@ public function get_snapshot_uuid() {
10021002
}
10031003

10041004
/**
1005-
* Replaces the "Customize" link in the Toolbar.
1005+
* Toolbar modifications for Customize Snapshot
10061006
*
10071007
* @param \WP_Admin_Bar $wp_admin_bar WP_Admin_Bar instance.
10081008
*/
10091009
public function customize_menu( $wp_admin_bar ) {
1010+
1011+
$this->replace_customize_link( $wp_admin_bar );
1012+
$this->add_post_edit_screen_link( $wp_admin_bar );
1013+
1014+
add_action( 'wp_before_admin_bar_render', 'wp_customize_support_script' );
1015+
}
1016+
1017+
/**
1018+
* Adds a "Snapshot in Dashboard" link to the Toolbar when in Snapshot mode.
1019+
*
1020+
* @param \WP_Admin_Bar $wp_admin_bar WP_Admin_Bar instance.
1021+
*/
1022+
public function add_post_edit_screen_link( $wp_admin_bar ) {
1023+
$snapshot_post = $this->snapshot->post();
1024+
if ( ! $snapshot_post ) {
1025+
return;
1026+
}
1027+
1028+
$wp_admin_bar->add_node( array(
1029+
'parent' => 'customize',
1030+
'id' => 'snapshot-view-link',
1031+
'title' => __( 'View Snapshot', 'customize-snapshots' ),
1032+
'href' => get_edit_post_link( $snapshot_post->ID ),
1033+
) );
1034+
}
1035+
1036+
/**
1037+
* Replaces the "Customize" link in the Toolbar.
1038+
*
1039+
* @param \WP_Admin_Bar $wp_admin_bar WP_Admin_Bar instance.
1040+
*/
1041+
public function replace_customize_link( $wp_admin_bar ) {
1042+
10101043
// Don't show for users who can't access the customizer or when in the admin.
10111044
if ( ! current_user_can( 'customize' ) || is_admin() ) {
10121045
return;
@@ -1032,7 +1065,6 @@ public function customize_menu( $wp_admin_bar ) {
10321065
),
10331066
)
10341067
);
1035-
add_action( 'wp_before_admin_bar_render', 'wp_customize_support_script' );
10361068
}
10371069

10381070
/**

tests/php/test-class-customize-snapshot-manager.php

+4-7
Original file line numberDiff line numberDiff line change
@@ -166,19 +166,16 @@ function test_clean_current_url() {
166166
}
167167

168168
/**
169+
* Test Customize_Snapshot_Manager::create_post_type().
170+
*
169171
* @see Customize_Snapshot_Manager::create_post_type()
170172
*/
171173
function test_create_post_type() {
172-
global $wp_version;
173174
$pobj = get_post_type_object( Customize_Snapshot_Manager::POST_TYPE );
174-
if ( version_compare( $wp_version, '4.6-alpha', '>=' ) && is_multisite() ) {
175-
$this->assertInstanceOf( 'WP_Post_Type', $pobj );
176-
} else {
177-
$this->assertInstanceOf( 'stdClass', $pobj );
178-
}
175+
$this->assertNotNull( $pobj );
179176
$this->assertEquals( Customize_Snapshot_Manager::POST_TYPE, $pobj->name );
180177

181-
// Test some defaults
178+
// Test some defaults.
182179
$this->assertFalse( is_post_type_hierarchical( Customize_Snapshot_Manager::POST_TYPE ) );
183180
$this->assertEquals( array(), get_object_taxonomies( Customize_Snapshot_Manager::POST_TYPE ) );
184181
}

0 commit comments

Comments
 (0)