Module_Manager::unregister( string $slug )

Unregisters a new module.

Description

See also

Parameters

$slug

(string) (Required) Module slug.

Return

(bool|awsmug\Torro_Forms\Error) True on success, error object on failure.

Source

File: src/modules/module-manager.php

	public function unregister( $slug ) {
		if ( ! isset( $this->modules[ $slug ] ) ) {
			/* translators: %s: module slug */
			return new Error( $this->get_prefix() . 'module_not_exist', sprintf( __( 'A module with the slug %s does not exist.', 'torro-forms' ), $slug ), __METHOD__, '1.0.0' );
		}

		if ( isset( $this->default_modules[ $slug ] ) ) {
			/* translators: %s: module slug */
			return new Error( $this->get_prefix() . 'module_is_default', sprintf( __( 'The default module %s cannot be unregistered.', 'torro-forms' ), $slug ), __METHOD__, '1.0.0' );
		}

		unset( $this->modules[ $slug ] );

		return true;
	}

Changelog

Changelog
Version Description
1.0.0 Introduced.