-
Notifications
You must be signed in to change notification settings - Fork 11
Enable status button if current theme is not active. #132
Changes from 1 commit
e696e8f
80fe277
023a0a6
a372282
c71add1
58f0ce9
7a6330a
cc2f54d
26f7316
d43b570
2559457
9ca3ff2
a71adbb
eb003e3
52694b6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -203,6 +203,7 @@ public function ensure_customize_manager() { | |
* | ||
* @return bool Whether theme is active. | ||
* | ||
* @deprecated in favor of WP_Customize_Manager::is_theme_active() | ||
* @todo move to back compat? | ||
*/ | ||
public function is_theme_active() { | ||
|
@@ -225,7 +226,7 @@ public function add_snapshot_uuid_to_return_url() { | |
&& | ||
$this->current_snapshot_uuid | ||
&& | ||
$this->is_theme_active() | ||
$this->customize_manager->is_theme_active() | ||
&& | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @westonruter Not sure why There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's because the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be fixed in 52694b6. |
||
false === strpos( $this->customize_manager->get_return_url(), '/wp-admin/' ) | ||
); | ||
|
@@ -263,11 +264,7 @@ static public function encode_json( $value ) { | |
* @global \WP_Customize_Manager $wp_customize | ||
*/ | ||
public function enqueue_controls_scripts() { | ||
|
||
// Prevent loading the Snapshot interface if the theme is not active. | ||
if ( ! $this->is_theme_active() ) { | ||
return; | ||
} | ||
$this->ensure_customize_manager(); | ||
|
||
wp_enqueue_style( 'customize-snapshots' ); | ||
wp_enqueue_script( 'customize-snapshots' ); | ||
|
@@ -281,7 +278,6 @@ public function enqueue_controls_scripts() { | |
$this->override_post_date_default_data( $post ); | ||
$edit_link = $this->snapshot->get_edit_link( $post ); | ||
} | ||
$preview_url_query_vars = $this->post_type->get_customizer_state_query_vars( $post_id ); | ||
} | ||
|
||
// Script data array. | ||
|
@@ -293,7 +289,7 @@ public function enqueue_controls_scripts() { | |
'currentUserCanPublish' => current_user_can( 'customize_publish' ), | ||
'initialServerDate' => current_time( 'mysql', false ), | ||
'initialServerTimestamp' => floor( microtime( true ) * 1000 ), | ||
'previewingTheme' => isset( $preview_url_query_vars['theme'] ) ? $preview_url_query_vars['theme']: '', | ||
'previewingTheme' => ! $this->customize_manager->is_theme_active(), | ||
'i18n' => array( | ||
'saveButton' => __( 'Save', 'customize-snapshots' ), | ||
'updateButton' => __( 'Update', 'customize-snapshots' ), | ||
|
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.
@westonruter This is breaking my condition here
wp-customize-snapshots/js/compat/customize-snapshots.js
Line 278 in 9ca3ff2
There are several use cases where the button has to be enabled or disabled.
I was not able to satisfy these conditions with only boolean value of
previewingTheme
. This is as good asapi.state( 'activated' ).get()
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.
Thanks for pointing this out. So this can be fixed by reverting back to:
?
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.
Yes.