Skip to content

Commit

Permalink
Merge pull request #180 from moderntribe/feature/MOOSE-172/admin-menu…
Browse files Browse the repository at this point in the history
…-cleanup

[MOOSE-172] Admin Menu Cleanup
  • Loading branch information
GeoffDusome authored Jan 15, 2025
2 parents 3942389 + 021183e commit a171ab6
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 5 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ item (Added, Changed, Depreciated, Removed, Fixed, Security).

## [2025.01]

- Added: `Admin_Menu_Order` class to handle reordering the WP Admin menu items that Moose loads with by default.
This also includes Yoast SEO & RankMath, just in case either are used by default.
- Added: Node service to Lando so FE assets can be built automatically on start up.
- Updated: project start up scripts to automatically generate the correct contents of the lcoal config files.
- Updated: script to install WordPress so we can use a version constant and not install WP every time composer is
installed or updated.
- Updated: ESLint config now supports browser environment variable such as `IntersectionObserver`
- Updated: ESLint config now supports browser environment variables such as `IntersectionObserver`
- Added: ability for table blocks to utilize the `overflow-x` set on them by setting a `min-width` property for the
`table` element within the table block.
- Updated: Enabled background images on the Group block; We should try to use this instead of the Cover block where
Expand Down
3 changes: 2 additions & 1 deletion wp-content/plugins/core/src/Core.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ class Core {
* @var string[] Names of classes extending Abstract_Subscriber.
*/
private array $subscribers = [
Settings\Settings_Subscriber::class,
Assets\Assets_Subscriber::class,
Blocks\Blocks_Subscriber::class,
Integrations\Integrations_Subscriber::class,
Menus\Menu_Subscriber::class,
Object_Meta\Meta_Subscriber::class,
Settings\Settings_Subscriber::class,
Theme_Config\Theme_Config_Subscriber::class,

// Post Types
Expand Down
30 changes: 30 additions & 0 deletions wp-content/plugins/core/src/Menus/Admin_Menu_Order.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php declare(strict_types=1);

namespace Tribe\Plugin\Menus;

class Admin_Menu_Order {

public function custom_menu_order(): array {
return [
'index.php',
'separator1',
'edit.php?post_type=page',
// place CPTs here
'edit.php',
'upload.php',
'gf_edit_forms',
'separator2',
'themes.php',
'plugins.php',
'users.php',
'tools.php',
'options-general.php',
'edit.php?post_type=training',
'separator-last',
'edit.php?post_type=acf-field-group',
'wpseo_dashboard',
'rank-math',
];
}

}
17 changes: 17 additions & 0 deletions wp-content/plugins/core/src/Menus/Menu_Subscriber.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php declare(strict_types=1);

namespace Tribe\Plugin\Menus;

use Tribe\Plugin\Core\Abstract_Subscriber;

class Menu_Subscriber extends Abstract_Subscriber {

public function register(): void {
add_filter( 'custom_menu_order', '__return_true' );

add_filter( 'menu_order', function (): array {
return $this->container->get( Admin_Menu_Order::class )->custom_menu_order();
} );
}

}
7 changes: 4 additions & 3 deletions wp-content/plugins/core/src/Post_Types/Training/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ public function get_args(): array {

public function get_labels(): array {
return [
'singular' => __( 'Training Doc', 'tribe' ),
'plural' => __( 'Training Docs', 'tribe' ),
'slug' => $this->post_type,
'singular' => __( 'Training Doc', 'tribe' ),
'plural' => __( 'Training Docs', 'tribe' ),
'menu_name' => __( 'Training', 'tribe' ),
'slug' => $this->post_type,
];
}

Expand Down

0 comments on commit a171ab6

Please sign in to comment.