File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -727,7 +727,7 @@ namespace Bones {
727727 define ('WPBONES_MINIMAL_PHP_VERSION ' , '7.4 ' );
728728
729729 /* MARK: The WP Bones command line version. */
730- define ('WPBONES_COMMAND_LINE_VERSION ' , '1.9.4 ' );
730+ define ('WPBONES_COMMAND_LINE_VERSION ' , '1.9.6 ' );
731731
732732 use Bones \SemVer \Exceptions \InvalidVersionException ;
733733 use Bones \SemVer \Version ;
Original file line number Diff line number Diff line change 77}
88
99use WPKirk \WPBones \Support \ServiceProvider ;
10+ use WPKirk \WPBones \Support \Str ;
1011
1112/**
1213 * Class AdminRouteProvider
@@ -45,6 +46,17 @@ function () use ($page) {
4546 );
4647 });
4748
49+ if (isset ($ page ['route ' ]['load ' ])) {
50+ [$ controller , $ method ] = Str::parseCallback ($ page ['route ' ]['load ' ]);
51+
52+ add_action ("load-toplevel_page_ {$ page_slug }" , function () use ($ controller , $ method ) {
53+ $ className = "WPKirk \\Http \\Controllers \\{$ controller }" ;
54+ $ instance = new $ className ();
55+
56+ return $ instance ->{$ method }();
57+ });
58+ }
59+
4860 add_action ($ hookName , $ hook );
4961
5062 $ _registered_pages [$ hookName ] = true ;
You can’t perform that action at this time.
0 commit comments