Submodule_Registry_Interface

Interface for modules that act as a submodule registry.

Description

Source

File: src/modules/submodule-registry-interface.php

interface Submodule_Registry_Interface {

	/**
	 * Checks whether a specific submodule is registered.
	 *
	 * @since 1.0.0
	 *
	 * @param string $slug Submodule slug.
	 * @return bool True if the submodule is registered, false otherwise.
	 */
	public function has( $slug );

	/**
	 * Returns a specific registered submodule.
	 *
	 * @since 1.0.0
	 *
	 * @param string $slug Submodule slug.
	 * @return Submodule|Error Submodule instance, or error object if submodule is not registered.
	 */
	public function get( $slug );

	/**
	 * Returns all registered submodules.
	 *
	 * @since 1.0.0
	 *
	 * @return array Associative array of `$slug => $submodule_instance` pairs.
	 */
	public function get_all();

	/**
	 * Registers a new submodule.
	 *
	 * @since 1.0.0
	 *
	 * @param string $slug                 Submodule slug.
	 * @param string $submodule_class_name Submodule class name.
	 * @return bool|Error True on success, error object on failure.
	 */
	public function register( $slug, $submodule_class_name );

	/**
	 * Unregisters a new submodule.
	 *
	 * @since 1.0.0
	 *
	 * @param string $slug Submodule slug.
	 * @return bool|Error True on success, error object on failure.
	 */
	public function unregister( $slug );
}

Changelog

Changelog
Version Description
1.0.0 Introduced.

Methods

  • bootstrap — Bootstraps the module by setting properties.
  • is_final_submit_request — Checks whether the current request is the final submit request for a submission completion.
  • register_defaults — Registers the default protectors.
  • render_output — Renders the output for the protector before the Submit button.
  • setup_hooks — Sets up all action and filter hooks for the service.
  • verify_request — Verifies a request by ensuring that it is not spammy.