yii\base\Module::setModule PHP Method

setModule() public method

Adds a sub-module to this module.
public setModule ( string $id, Module | array | null $module )
$id string module ID.
$module Module | array | null the sub-module to be added to this module. This can be one of the following: - a [[Module]] object - a configuration array: when [[getModule()]] is called initially, the array will be used to instantiate the sub-module - `null`: the named sub-module will be removed from this module
    public function setModule($id, $module)
    {
        if ($module === null) {
            unset($this->_modules[$id]);
        } else {
            $this->_modules[$id] = $module;
        }
    }