Skip to content

Add conditional to display InMotion branded menu #109

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
181 changes: 126 additions & 55 deletions src/Library/Menu/External.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,71 +50,142 @@ public function addMenu( $wpAdminBar ) {
* @return array Menu Items.
*/
protected function getMenuItems() {
return array(
'topLevel' => array(
'id' => 'boldgrid-adminbar-icon',
'title' => '<span aria-hidden="true" class="boldgrid-icon ab-icon"></span>',
'href' => 'https://www.boldgrid.com/',
'meta' => array(
'class' => 'boldgrid-node-icon',
),
),
'items' => array(
array(
'id' => 'boldgrid-site-url',
'parent' => 'boldgrid-adminbar-icon',
'title' => 'BoldGrid.com',
'href' => 'https://www.boldgrid.com/',
'meta' => array(
'class' => 'boldgrid-dropdown',
'target' => '_blank',
'title' => 'BoldGrid.com',
$provider = get_option( 'boldgrid_connect_provider', 'BoldGrid' );

if ($provider === 'InMotion Hosting') {
return array(
'topLevel' => array(
'id' => 'boldgrid-adminbar-icon',
'title' => '<span aria-hidden="true" class="imh-icon ab-icon"></span>',
'href' => 'https://www.inmotionhosting.com/',
'meta' => array(
'class' => 'boldgrid-node-icon',
),
),
array(
'id' => 'boldgrid-site-documentation',
'parent' => 'boldgrid-adminbar-icon',
'title' => __( 'Documentation', 'boldgrid-library' ),
'href' => 'https://www.boldgrid.com/docs',
'meta' => array(
'class' => 'boldgrid-dropdown',
'target' => '_blank',
'items' => array(
array(
'id' => 'boldgrid-site-url',
'parent' => 'boldgrid-adminbar-icon',
'title' => 'InMotionHosting.com',
'href' => 'https://www.inmotionhosting.com/',
'meta' => array(
'class' => 'boldgrid-dropdown',
'target' => '_blank',
'title' => 'InMotionHosting.com',
),
),
array(
'id' => 'boldgrid-site-documentation',
'parent' => 'boldgrid-adminbar-icon',
'title' => __( 'Documentation', 'boldgrid-library' ),
'href' => 'https://www.inmotionhosting.com/support/product-guides/wordpress-hosting/central/',
'meta' => array(
'class' => 'boldgrid-dropdown',
'target' => '_blank',
'title' => __( 'Documentation', 'boldgrid-library' ),
),
),
),
array(
'id' => 'boldgrid-central-url',
'parent' => 'boldgrid-adminbar-icon',
'title' => 'BoldGrid Central',
'href' => 'https://www.boldgrid.com/central',
'meta' => array(
'class' => 'boldgrid-dropdown',
'target' => '_blank',
'title' => 'BoldGrid Central',
array(
'id' => 'boldgrid-central-url',
'parent' => 'boldgrid-adminbar-icon',
'title' => 'InMotion Central',
'href' => 'https://central.inmotionhosting.com/wordpress/',
'meta' => array(
'class' => 'boldgrid-dropdown',
'target' => '_blank',
'title' => 'InMotion Central',
),
),
),
array(
'id' => 'boldgrid-connect-url',
'parent' => 'boldgrid-adminbar-icon',
'title' => 'BoldGrid Connect',
'href' => get_admin_url( null, 'options-general.php?page=boldgrid-connect.php' ),
'meta' => array(
'class' => 'boldgrid-dropdown',
'title' => 'BoldGrid Connect',
array(
'id' => 'boldgrid-connect-url',
'parent' => 'boldgrid-adminbar-icon',
'title' => 'BoldGrid Connect',
'href' => get_admin_url( null, 'options-general.php?page=boldgrid-connect.php' ),
'meta' => array(
'class' => 'boldgrid-dropdown',
'title' => 'BoldGrid Connect',
),
),
array(
'id' => 'boldgrid-feedback-url',
'parent' => 'boldgrid-adminbar-icon',
'title' => __( 'Feedback', 'boldgrid-library' ),
'href' => 'https://www.inmotionhosting.com/feedback',
'meta' => array(
'class' => 'boldgrid-dropdown',
'target' => '_blank',
'title' => __( 'Feedback', 'boldgrid-library' ),
),
),
),
array(
'id' => 'boldgrid-feedback-url',
'parent' => 'boldgrid-adminbar-icon',
'title' => __( 'Feedback', 'boldgrid-library' ),
'href' => 'https://www.boldgrid.com/feedback',
);
} else {
return array(
'topLevel' => array(
'id' => 'boldgrid-adminbar-icon',
'title' => '<span aria-hidden="true" class="boldgrid-icon ab-icon"></span>',
'href' => 'https://www.boldgrid.com/',
'meta' => array(
'class' => 'boldgrid-dropdown',
'target' => '_blank',
'class' => 'boldgrid-node-icon',
),
),
'items' => array(
array(
'id' => 'boldgrid-site-url',
'parent' => 'boldgrid-adminbar-icon',
'title' => 'BoldGrid.com',
'href' => 'https://www.boldgrid.com/',
'meta' => array(
'class' => 'boldgrid-dropdown',
'target' => '_blank',
'title' => 'BoldGrid.com',
),
),
array(
'id' => 'boldgrid-site-documentation',
'parent' => 'boldgrid-adminbar-icon',
'title' => __( 'Documentation', 'boldgrid-library' ),
'href' => 'https://www.boldgrid.com/docs',
'meta' => array(
'class' => 'boldgrid-dropdown',
'target' => '_blank',
'title' => __( 'Documentation', 'boldgrid-library' ),
),
),
array(
'id' => 'boldgrid-central-url',
'parent' => 'boldgrid-adminbar-icon',
'title' => 'BoldGrid Central',
'href' => 'https://www.boldgrid.com/central',
'meta' => array(
'class' => 'boldgrid-dropdown',
'target' => '_blank',
'title' => 'BoldGrid Central',
),
),
array(
'id' => 'boldgrid-connect-url',
'parent' => 'boldgrid-adminbar-icon',
'title' => 'BoldGrid Connect',
'href' => get_admin_url( null, 'options-general.php?page=boldgrid-connect.php' ),
'meta' => array(
'class' => 'boldgrid-dropdown',
'title' => 'BoldGrid Connect',
),
),
array(
'id' => 'boldgrid-feedback-url',
'parent' => 'boldgrid-adminbar-icon',
'title' => __( 'Feedback', 'boldgrid-library' ),
'href' => 'https://www.boldgrid.com/feedback',
'meta' => array(
'class' => 'boldgrid-dropdown',
'target' => '_blank',
'title' => __( 'Feedback', 'boldgrid-library' ),
),
),
),
),
);
);
}
}
}