public function handleModels(array $models)
    {
        $builder = $this->builder;

        $builder->start();

        foreach ($models as $model) {
            $languages = (array)(isset($model->sitemapLanguages) ? $model->sitemapLanguages : Yii::$app->language);

            if (count($languages) > 1) {
                // Handle separately for each language
                foreach ($languages as $language) {
                    // Swith App language to $language
                    if (isset($model->sitemapSwithLanguages) && $model->sitemapSwithLanguages) {
                        static::setLanguage($language);
                    }

                    $this->handleModel($model, $language);

                    // Restore App language
                    static::restoreLanguage();
                }
            } else {
                // Handle only one language
                $this->handleModel($model, null);
            }
        }

        $builder->finish();
    }
public function handleModels(array $models)
    {
        $builder = $this->builder;

        $builder->start();

        foreach ($models as $model) {
            $languages = (array)(isset($model->sitemapLanguages) ? $model->sitemapLanguages : Yii::$app->language);

            if (count($languages) > 1) {
                // Handle separately for each language
                foreach ($languages as $language) {
                    // Swith App language to $language
                    if (isset($model->sitemapSwithLanguages) && $model->sitemapSwithLanguages) {
                        static::setLanguage($language);
                    }

                    $this->handleModel($model, $language);

                    // Restore App language
                    static::restoreLanguage();
                }
            } else {
                // Handle only one language
                $this->handleModel($model, null);
            }
        }

        $builder->finish();
    }
public function handleModels ( array $ models ) { $ builder = $ this -> builder ; $ builder -> start ( ) ; foreach ( $ models as $ model ) { $ languages = ( array ) ( isset ( $ model -> sitemapLanguages ) ? $ model -> sitemapLanguages : Yii :: $ app -> language ) ; if ( count ( $ languages ) > 1 ) { // Handle separately for each language foreach ( $ languages as $ language ) { // Swith App language to $language if ( isset ( $ model -> sitemapSwithLanguages ) && $ model -> sitemapSwithLanguages ) { static :: setLanguage ( $ language ) ; } $ this -> handleModel ( $ model , $ language ) ; // Restore App language static :: restoreLanguage ( ) ; } } else { // Handle only one language $ this -> handleModel ( $ model , null ) ; } } $ builder -> finish ( ) ; }
Start sitemap generate

@param Basic[] $models
Start sitemap generate