Closed k1sul1 closed 6 years ago
And it also allows plugins to "tap into" add_submenu_page without having to deal with it's shit, which also helps keep the admin area free of otherwise useless plugin setting pages.
Went a bit further. Anyone can still add their own stuff to the WPLF class instance, but at least I don't want to do it. Instead, it's now required to pass the plugin instance to wplf()->plugins->register([])
.
$wplf = wplf();
$builder = WP_Libre_Formbuilder::instance();
$wplf->plugins->register([
"name" => "Formbuilder",
"description" => "Visual editor for the HTML impaired.",
"link" => "https://github.com/k1sul1/wp-libre-formbuilder",
"version" => WPLFB_VERSION,
"instance" => $builder,
"settings_page" => [$builder, "render_settings_page"],
]);
The plugins class is using getters to expose plugins with the name. Any public method in the instance is callable by anyone.
wplf()->plugins->Formbuilder->addField([])
Screenshots:
Done unless you have any requests for changes.
Basically allows plugins to register as WPLF plugins and expose methods to
wplf()
.