private function loadAssetsFromConfig($content, $dir, $type = null, $isFromVendor = false, $siteName = '')
    {
        $newContent = $content;
        $assetsConfig = $dir.'assets.config.php';
        /**
         * check if the config exist
         */
        if (file_exists($assetsConfig)) {
            $files = include($assetsConfig);
            /**
             * check if assets config is not empty
             */
            if (!empty($files)) {
                foreach($files as $key => $file){
                    /**
                     * check if type to know what asset are
                     * we going to load
                     */
                    if(empty($type)) {
                        /**
                         * this will load the assets from the config
                         */
                        $cssToAdd = "\n";
                        $jsToLoad = "\n";
                        if (strtolower($key) == 'css') {
                            foreach ($file as $k => $css) {
                                $css = str_replace('/public', '', $css);
                                $css = $this->editFileName($css, $isFromVendor, $siteName);
                                $cssToAdd .= '<link href="' . $css . '" media="screen" rel="stylesheet" type="text/css">' . "\n";
                            }
                        }
                        elseif (strtolower($key) == 'js') {
                            foreach ($file as $k => $js) {
                                $js = str_replace('/public', '', $js);
                                $js = $this->editFileName($js, $isFromVendor, $siteName);
                                $jsToLoad .= '<script type="text/javascript" src="' . $js . '"></script>' . "\n";
                            }
                        }
                        $newContent = $this->createLink($newContent, $cssToAdd, $jsToLoad);
                    }
                    elseif($type == 'css'){
                        /**
                         * this will load only the css
                         * from the config
                         */
                        if (strtolower($key) == 'css') {
                            $cssToAdd = "\n";
                            foreach ($file as $k => $css) {
                                $css = str_replace('/public', '', $css);
                                $css = $this->editFileName($css, $isFromVendor, $siteName);
                                $cssToAdd .= '<link href="' . $css . '" media="screen" rel="stylesheet" type="text/css">' . "\n";
                            }
                            $newContent = $this->createCssLink($content, $cssToAdd);
                        }
                    }elseif($type == 'js'){
                        /**
                         * this will load the js only from the config
                         */
                        if (strtolower($key) == 'js') {
                            $jsToLoad = "\n";
                            foreach ($file as $k => $js) {
                                $js = str_replace('/public', '', $js);
                                $js = $this->editFileName($js, $isFromVendor, $siteName);
                                $jsToLoad .= '<script type="text/javascript" src="' . $js . '"></script>' . "\n";
                            }
                            $newContent = $this->createJsLink($content, $jsToLoad);
                        }
                    }
                }
            }
        }
        return $newContent;
    }
private function loadAssetsFromConfig($content, $dir, $type = null, $isFromVendor = false, $siteName = '')
    {
        $newContent = $content;
        $assetsConfig = $dir.'assets.config.php';
        /**
         * check if the config exist
         */
        if (file_exists($assetsConfig)) {
            $files = include($assetsConfig);
            /**
             * check if assets config is not empty
             */
            if (!empty($files)) {
                foreach($files as $key => $file){
                    /**
                     * check if type to know what asset are
                     * we going to load
                     */
                    if(empty($type)) {
                        /**
                         * this will load the assets from the config
                         */
                        $cssToAdd = "\n";
                        $jsToLoad = "\n";
                        if (strtolower($key) == 'css') {
                            foreach ($file as $k => $css) {
                                $css = str_replace('/public', '', $css);
                                $css = $this->editFileName($css, $isFromVendor, $siteName);
                                $cssToAdd .= '<link href="' . $css . '" media="screen" rel="stylesheet" type="text/css">' . "\n";
                            }
                        }
                        elseif (strtolower($key) == 'js') {
                            foreach ($file as $k => $js) {
                                $js = str_replace('/public', '', $js);
                                $js = $this->editFileName($js, $isFromVendor, $siteName);
                                $jsToLoad .= '<script type="text/javascript" src="' . $js . '"></script>' . "\n";
                            }
                        }
                        $newContent = $this->createLink($newContent, $cssToAdd, $jsToLoad);
                    }
                    elseif($type == 'css'){
                        /**
                         * this will load only the css
                         * from the config
                         */
                        if (strtolower($key) == 'css') {
                            $cssToAdd = "\n";
                            foreach ($file as $k => $css) {
                                $css = str_replace('/public', '', $css);
                                $css = $this->editFileName($css, $isFromVendor, $siteName);
                                $cssToAdd .= '<link href="' . $css . '" media="screen" rel="stylesheet" type="text/css">' . "\n";
                            }
                            $newContent = $this->createCssLink($content, $cssToAdd);
                        }
                    }elseif($type == 'js'){
                        /**
                         * this will load the js only from the config
                         */
                        if (strtolower($key) == 'js') {
                            $jsToLoad = "\n";
                            foreach ($file as $k => $js) {
                                $js = str_replace('/public', '', $js);
                                $js = $this->editFileName($js, $isFromVendor, $siteName);
                                $jsToLoad .= '<script type="text/javascript" src="' . $js . '"></script>' . "\n";
                            }
                            $newContent = $this->createJsLink($content, $jsToLoad);
                        }
                    }
                }
            }
        }
        return $newContent;
    }
private function loadAssetsFromConfig ( $ content , $ dir , $ type = null , $ isFromVendor = false , $ siteName = '' ) { $ newContent = $ content ; $ assetsConfig = $ dir . 'assets.config.php' ; /**
         * check if the config exist
         */ if ( file_exists ( $ assetsConfig ) ) { $ files = include ( $ assetsConfig ) ; /**
             * check if assets config is not empty
             */ if ( ! empty ( $ files ) ) { foreach ( $ files as $ key => $ file ) { /**
                     * check if type to know what asset are
                     * we going to load
                     */ if ( empty ( $ type ) ) { /**
                         * this will load the assets from the config
                         */ $ cssToAdd = "\n" ; $ jsToLoad = "\n" ; if ( strtolower ( $ key ) == 'css' ) { foreach ( $ file as $ k => $ css ) { $ css = str_replace ( '/public' , '' , $ css ) ; $ css = $ this -> editFileName ( $ css , $ isFromVendor , $ siteName ) ; $ cssToAdd .= '<link href="' . $ css . '" media="screen" rel="stylesheet" type="text/css">' . "\n" ; } } elseif ( strtolower ( $ key ) == 'js' ) { foreach ( $ file as $ k => $ js ) { $ js = str_replace ( '/public' , '' , $ js ) ; $ js = $ this -> editFileName ( $ js , $ isFromVendor , $ siteName ) ; $ jsToLoad .= '<script type="text/javascript" src="' . $ js . '"></script>' . "\n" ; } } $ newContent = $ this -> createLink ( $ newContent , $ cssToAdd , $ jsToLoad ) ; } elseif ( $ type == 'css' ) { /**
                         * this will load only the css
                         * from the config
                         */ if ( strtolower ( $ key ) == 'css' ) { $ cssToAdd = "\n" ; foreach ( $ file as $ k => $ css ) { $ css = str_replace ( '/public' , '' , $ css ) ; $ css = $ this -> editFileName ( $ css , $ isFromVendor , $ siteName ) ; $ cssToAdd .= '<link href="' . $ css . '" media="screen" rel="stylesheet" type="text/css">' . "\n" ; } $ newContent = $ this -> createCssLink ( $ content , $ cssToAdd ) ; } } elseif ( $ type == 'js' ) { /**
                         * this will load the js only from the config
                         */ if ( strtolower ( $ key ) == 'js' ) { $ jsToLoad = "\n" ; foreach ( $ file as $ k => $ js ) { $ js = str_replace ( '/public' , '' , $ js ) ; $ js = $ this -> editFileName ( $ js , $ isFromVendor , $ siteName ) ; $ jsToLoad .= '<script type="text/javascript" src="' . $ js . '"></script>' . "\n" ; } $ newContent = $ this -> createJsLink ( $ content , $ jsToLoad ) ; } } } } } return $ newContent ; }
Function to get all the assets for the
config to load if the bundle does'nt exist

@param $content
@param $dir
@param null $type
@param bool $isFromVendor
@param string $siteName
@return string
Function to get all the assets for the config to load if the bundle does nt exist