List payment step service plugins to install
This commit is contained in:
parent
390288e283
commit
9b524d7d77
|
@ -947,6 +947,27 @@ h3.jetpack-reasons {
|
|||
}
|
||||
}
|
||||
|
||||
.wc-setup .wc-setup-actions .plugin-install-info {
|
||||
display: block;
|
||||
font-style: italic;
|
||||
color: #999;
|
||||
font-size: 14px;
|
||||
line-height: 1.5em;
|
||||
margin: 5px 0;
|
||||
|
||||
& > * {
|
||||
display: block;
|
||||
}
|
||||
|
||||
a {
|
||||
white-space: nowrap;
|
||||
|
||||
&:not(:hover):not(:focus) {
|
||||
color: inherit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.location-prompt {
|
||||
color: #666;
|
||||
font-size: 13px;
|
||||
|
|
|
@ -176,4 +176,34 @@ jQuery( function( $ ) {
|
|||
var countryCode = $( this ).val();
|
||||
$( 'select#currency_code' ).val( wc_setup_currencies[ countryCode ] ).change();
|
||||
} );
|
||||
|
||||
$( '.wc-setup-content' ).on( 'change', '[data-plugins]', function() {
|
||||
var pluginLinkBySlug = {};
|
||||
|
||||
function addPlugins( plugins ) {
|
||||
if ( Array.isArray( plugins ) ) {
|
||||
for ( var i in plugins ) {
|
||||
var pluginLink = '<a href="https://wordpress.org/plugins/' + plugins[ i ].slug + '/" target="_blank">' + plugins[ i ].name + '</a>';
|
||||
pluginLinkBySlug[ plugins[ i ].slug ] = pluginLink;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$( '.wc-wizard-service-enable input:checked' ).each( function() {
|
||||
addPlugins( $( this ).data( 'plugins' ) );
|
||||
} );
|
||||
|
||||
// Render list of plugins.
|
||||
if ( Object.keys( pluginLinkBySlug ).length ) {
|
||||
var pluginLinks = [];
|
||||
for ( var slug in pluginLinkBySlug ) {
|
||||
pluginLinks.push( pluginLinkBySlug[ slug ] );
|
||||
}
|
||||
|
||||
$( 'span.plugin-install-info' ).show();
|
||||
$( 'span.plugin-install-info-list' ).html( pluginLinks.join( ', ' ) );
|
||||
} else {
|
||||
$( 'span.plugin-install-info' ).hide();
|
||||
}
|
||||
} ).find( '[data-plugins]' ).change();
|
||||
} );
|
||||
|
|
|
@ -1406,6 +1406,8 @@ class WC_Admin_Setup_Wizard {
|
|||
$should_enable_toggle = isset( $item_info['enabled'] ) && $item_info['enabled'];
|
||||
}
|
||||
|
||||
$plugins = isset( $item_info['repo-slug'] ) ? array( array( 'slug' => $item_info['repo-slug'], 'name' => $item_info['name'] ) ) : null;
|
||||
|
||||
?>
|
||||
<li class="<?php echo esc_attr( $item_class ); ?>">
|
||||
<div class="wc-wizard-service-name">
|
||||
|
@ -1468,6 +1470,7 @@ class WC_Admin_Setup_Wizard {
|
|||
type="checkbox"
|
||||
name="wc-wizard-service-<?php echo esc_attr( $item_id ); ?>-enabled"
|
||||
value="yes" <?php checked( $should_enable_toggle ); ?>
|
||||
data-plugins="<?php echo esc_attr( json_encode( $plugins ) ); ?>"
|
||||
/>
|
||||
<label for="wc-wizard-service-<?php echo esc_attr( $item_id ); ?>">
|
||||
</span>
|
||||
|
@ -1496,6 +1499,15 @@ class WC_Admin_Setup_Wizard {
|
|||
return ! $this->is_featured_service( $service );
|
||||
}
|
||||
|
||||
public function plugin_install_info() {
|
||||
?>
|
||||
<span class="plugin-install-info">
|
||||
<span class="plugin-install-info-label"><?php esc_html_e( 'The following plugins will be installed and activated for you:', 'woocommerce' ); ?></span>
|
||||
<span class="plugin-install-info-list"></span>
|
||||
</span>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Payment Step.
|
||||
*/
|
||||
|
@ -1561,6 +1573,7 @@ class WC_Admin_Setup_Wizard {
|
|||
?>
|
||||
</ul>
|
||||
<p class="wc-setup-actions step">
|
||||
<?php $this->plugin_install_info(); ?>
|
||||
<button type="submit" class="button-primary button button-large button-next" value="<?php esc_attr_e( 'Continue', 'woocommerce' ); ?>" name="save_step"><?php esc_html_e( 'Continue', 'woocommerce' ); ?></button>
|
||||
<?php wp_nonce_field( 'wc-setup' ); ?>
|
||||
</p>
|
||||
|
|
Loading…
Reference in New Issue