-
Notifications
You must be signed in to change notification settings - Fork 806
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Action Bar: Add Action Bar visibility
general setting
#41015
base: trunk
Are you sure you want to change the base?
Changes from all commits
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: patch | ||
Type: added | ||
|
||
Add `Action Bar visibility` general setting |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,32 @@ | |
use Automattic\Jetpack\Status; | ||
use Automattic\Jetpack\Status\Host; | ||
|
||
/** | ||
* Add the Action Bar display setting on the General settings page. | ||
* This setting allows users to hide the Action Bar on the front end of their site. | ||
* The setting is stored in the `wpcom_show_action_bar` option. | ||
* The setting is displayed only if the has the wp-admin interface selected. | ||
*/ | ||
function wpcomsh_wpcom_show_action_bar_settings_field() { | ||
add_settings_field( 'wpcom_show_action_bar', '', 'wpcom_show_action_bar_display', 'general', 'default' ); | ||
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. I realized that atomic sites don't show the Action Bar and I'm wondering whether we should check about the type before adding this setting ( at least for now ). 🤔 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. Yeah, we should check if the site is Simple before running this. Alternatively, if there are no plans to bring the action bar to Atomic sites, you could implement this logic directly in 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. There is an issue asking for the action bar in atomic sites: Automattic/wp-calypso#36795 In order to do that, I think we should move the actionbar mu-plugin from 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.
Yes. @cbravobernal is something you're working on? My linked issue with yours are kind of co-dependent. 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. Not yet, I was checking how to do it while I found this task and decided to wait. Feel free to take it if you feel more comfortable tackling all together. 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. @cbravobernal sounds good. I'll see what's decided about atomic and handle these two issues accordingly. 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.
I would also recommend keeping things together in the dotcom codebase for now. It will make it easier to move things around when/if we eventually bring the action bar to WoA sites. 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. Sounds good. I'll port these changes to dotcom. |
||
|
||
register_setting( 'general', 'wpcom_show_action_bar', array( 'sanitize_callback' => 'esc_attr' ) ); | ||
} | ||
|
||
/** | ||
* Display the `wpcom_show_action_bar setting` on the General settings page. | ||
*/ | ||
function wpcom_show_action_bar_display() { | ||
$value = get_option( 'wpcom_show_action_bar', 1 ); | ||
|
||
echo '<tr valign="top"><th scope="row">' . esc_html__( 'Action Bar visibility', 'jetpack-mu-wpcom' ) . '</th>'; | ||
echo '<td><label for="wpcom_show_action_bar">'; | ||
echo '<input type="checkbox" id="wpcom_show_action_bar" name="wpcom_show_action_bar" value="1" ' . checked( $value, 1, false ) . ' />'; | ||
echo esc_html__( 'Show the Action Bar on the front end of the site.', 'jetpack-mu-wpcom' ) . '</label>'; | ||
echo '<p class="description"><a href="https://en.support.wordpress.com/action-bar/">' . esc_html__( 'Learn more about Action Bar.', 'jetpack-mu-wpcom' ) . '</a></p></td></tr>'; | ||
} | ||
add_action( 'admin_init', 'wpcomsh_wpcom_show_action_bar_settings_field' ); | ||
|
||
/** | ||
* Add the Admin Interface Style setting on the General settings page. | ||
* This setting allows users to switch between the classic WP-Admin interface and the WordPress.com legacy dashboard. | ||
|
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.
The
wpcom-admin-interface.php
file was intended to contain logic involving the different admin interfaces (Default, Classic), so I'd move this part to somewhere else. Maybe you can add a newfeatures/action-bar/action-bar.php
file?Also, this isn't a wpcomsh function, so I'd remove that prefix.