public function registerComponent($className, $code = null, $plugin = null)
    {
        if (!$this->classMap) {
            $this->classMap = [];
        }

        if (!$this->codeMap) {
            $this->codeMap = [];
        }

        if (!$code) {
            $code = Str::getClassId($className);
        }

        if ($code == 'viewBag' && $className != 'Cms\Components\ViewBag') {
            throw new SystemException(sprintf(
                'The component code viewBag is reserved. Please use another code for the component class %s.',
                $className
            ));
        }

        $className = Str::normalizeClassName($className);
        $this->codeMap[$code] = $className;
        $this->classMap[$className] = $code;
        if ($plugin !== null) {
            $this->pluginMap[$className] = $plugin;
        }
    }
public function registerComponent($className, $code = null, $plugin = null)
    {
        if (!$this->classMap) {
            $this->classMap = [];
        }

        if (!$this->codeMap) {
            $this->codeMap = [];
        }

        if (!$code) {
            $code = Str::getClassId($className);
        }

        if ($code == 'viewBag' && $className != 'Cms\Components\ViewBag') {
            throw new SystemException(sprintf(
                'The component code viewBag is reserved. Please use another code for the component class %s.',
                $className
            ));
        }

        $className = Str::normalizeClassName($className);
        $this->codeMap[$code] = $className;
        $this->classMap[$className] = $code;
        if ($plugin !== null) {
            $this->pluginMap[$className] = $plugin;
        }
    }
public function registerComponent ( $ className , $ code = null , $ plugin = null ) { if ( ! $ this -> classMap ) { $ this -> classMap = [ ] ; } if ( ! $ this -> codeMap ) { $ this -> codeMap = [ ] ; } if ( ! $ code ) { $ code = Str :: getClassId ( $ className ) ; } if ( $ code == 'viewBag' && $ className != 'Cms\Components\ViewBag' ) { throw new SystemException ( sprintf ( 'The component code viewBag is reserved. Please use another code for the component class %s.' , $ className ) ) ; } $ className = Str :: normalizeClassName ( $ className ) ; $ this -> codeMap [ $ code ] = $ className ; $ this -> classMap [ $ className ] = $ code ; if ( $ plugin !== null ) { $ this -> pluginMap [ $ className ] = $ plugin ; } }
Registers a single component.
Registers a single component .