refactor: refactor widget registration

This commit is contained in:
Ben Goldsworthy 2021-04-27 09:31:08 +01:00
parent 51f3f92c26
commit 850ab084ff
3 changed files with 25 additions and 19 deletions

View file

@ -77,19 +77,6 @@ class Footnotes_Loader {
$this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args );
}
/**
* Initializes all Widgets of the Plugin.
*
* @since 1.5.0
* @since 2.8.0 Moved to `Footnotes_Loader` class.
*/
public function initialize_widgets() {
// TODO: This probably shouldn't be necessary here.
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/widget/class-footnotes-widget-reference-container.php';
register_widget( 'Footnotes_Widget_Reference_Container' );
}
/**
* A utility function that is used to register the actions and hooks into a single
* collection.
@ -133,8 +120,6 @@ class Footnotes_Loader {
add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
}
add_action( 'widgets_init', array( $this, 'initialize_widgets' ) );
}
}