Skip to content

Commit 77cf09f

Browse files
author
madalingorbanescu
committed
Add Customizer link in Notice
1 parent 4c526d6 commit 77cf09f

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

lib/client-assets.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,13 @@ function novablocks_register_packages_scripts() {
186186
'novablocks_core_frontend_stylesheet' => novablocks_get_plugin_url() . '/build/core/style.css',
187187
'novablocks_components_frontend_stylesheet' => novablocks_get_plugin_url() . '/build/components/style.css',
188188
'novablocks_opentable_frontend_stylesheet' => novablocks_get_plugin_url() . '/build/block-library/blocks/opentable/style.css',
189-
'novablocks_opentable_editor_stylesheet' => novablocks_get_plugin_url() . '/build/block-library/blocks/opentable/editor-styles.css'
189+
'novablocks_opentable_editor_stylesheet' => novablocks_get_plugin_url() . '/build/block-library/blocks/opentable/editor-styles.css',
190+
'novablocks_customizer_header_link' => novablocks_get_customizer_link(false,
191+
array(
192+
"autofocus[panel]" => "theme_options_panel",
193+
"autofocus[section]" => "rosa2_options[header_section]"
194+
)
195+
)
190196
) );
191197

192198
wp_set_script_translations( 'novablocks-core', '__plugin_txtd', novablocks_get_plugin_path() . 'languages' );

lib/extras.php

+23
Original file line numberDiff line numberDiff line change
@@ -1614,3 +1614,26 @@ function novablocks_get_localize_to_window_script( $object_name, $l10n ) {
16141614

16151615
return $script;
16161616
}
1617+
1618+
function novablocks_get_customizer_link( $return_url = false, $extra_query_args = array() ) {
1619+
global $wp;
1620+
1621+
1622+
if ( empty( $return_url ) ) {
1623+
// Get the current frontend URL.
1624+
$return_url = home_url( add_query_arg( array(), $wp->request ) );
1625+
}
1626+
1627+
// Now get the Customizer URL.
1628+
$link = wp_customize_url();
1629+
1630+
$link = add_query_arg( 'return_url', rawurlencode( $return_url ), $link );
1631+
1632+
if ( ! empty( $extra_query_args ) && is_array( $extra_query_args ) && ! wp_is_numeric_array( $extra_query_args ) ) {
1633+
foreach ( $extra_query_args as $key => $value ) {
1634+
$link = add_query_arg( rawurlencode( $key ), rawurlencode( utf8_uri_encode( $value ) ), $link );
1635+
}
1636+
}
1637+
1638+
return $link;
1639+
}

packages/block-library/src/blocks/header/inspector-controls.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,15 @@ const HeaderInspectorControls = ( props ) => {
3838

3939
const [ lastStickyRowId, setLastStickyRowId ] = useState( stickyRow?.clientId );
4040

41+
const customizerHeaderLink = novablocks_urls.novablocks_customizer_header_link;
42+
4143
return (
4244
<ControlsSection label={ __('Layout') }>
4345
<ControlsTab label={__('Settings') }>
4446
<Notice
4547
key={ 'header-position-quick-start' }
4648
id={ 'novablocks-header-position-quick-start' }
47-
content={ <p><strong>Quick start:</strong> Set up your header layout using the options below and go to <a href="#">Customizer</a> to change the logo and menu content, or fine-tune styling details. </p> }
49+
content={ <p><strong>Quick start:</strong> Set up your header layout using the options below and go to <a href={customizerHeaderLink}>Customizer</a> to change the logo and menu content, or fine-tune styling details. </p> }
4850
/>
4951

5052
<RadioControl

0 commit comments

Comments
 (0)