Submodule_Registry_Trait::unregister( string $slug )

Unregisters a new submodule.

Description

Parameters

$slug

(string) (Required) Submodule slug.

Return

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

Source

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

	public function unregister( $slug ) {
		if ( ! $this->has( $slug ) ) {
			/* translators: %s: submodule slug */
			return new Error( $this->get_prefix() . 'submodule_not_exist', sprintf( __( 'An submodule with the slug %s does not exist.', 'torro-forms' ), $slug ), __METHOD__, '1.0.0' );
		}

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

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

		return true;
	}

Changelog

Changelog
Version Description
1.0.0 Introduced.