Backend\Modules\Pages\Installer\Installer::installExampleData PHP 메소드

installExampleData() 개인적인 메소드

Install example data
private installExampleData ( )
    private function installExampleData()
    {
        // insert/get extra ids
        $extras['blog_block'] = $this->insertExtra('Blog', ModuleExtraType::block(), 'Blog', null, null, 'N', 1000);
        $extras['blog_widget_recent_comments'] = $this->insertExtra('Blog', ModuleExtraType::widget(), 'RecentComments', 'RecentComments', null, 'N', 1001);
        $extras['blog_widget_categories'] = $this->insertExtra('Blog', ModuleExtraType::widget(), 'Categories', 'Categories', null, 'N', 1002);
        $extras['blog_widget_archive'] = $this->insertExtra('Blog', ModuleExtraType::widget(), 'Archive', 'Archive', null, 'N', 1003);
        $extras['blog_widget_recent_articles_full'] = $this->insertExtra('Blog', ModuleExtraType::widget(), 'RecentArticlesFull', 'RecentArticlesFull', null, 'N', 1004);
        $extras['blog_widget_recent_articles_list'] = $this->insertExtra('Blog', ModuleExtraType::widget(), 'RecentArticlesList', 'RecentArticlesList', null, 'N', 1005);
        $extras['search'] = $this->insertExtra('Search', ModuleExtraType::block(), 'Search', null, null, 'N', 2000);
        $extras['search_form'] = $this->insertExtra('Search', ModuleExtraType::widget(), 'SearchForm', 'Form', null, 'N', 2001);
        $extras['sitemap_widget_sitemap'] = $this->insertExtra('Pages', ModuleExtraType::widget(), 'Sitemap', 'Sitemap', null, 'N', 1);
        $extras['subpages_widget'] = $this->insertExtra('Pages', ModuleExtraType::widget(), 'Subpages', 'Subpages', serialize(array('template' => 'SubpagesDefault.html.twig')), 'N', 2);
        // loop languages
        foreach ($this->getLanguages() as $language) {
            // check if pages already exist for this language
            if (!(bool) $this->getDB()->getVar('SELECT 1 FROM pages WHERE language = ? AND id > ? LIMIT 1', array($language, 404))) {
                // re-insert homepage
                $this->insertPage(array('id' => 1, 'parent_id' => 0, 'template_id' => $this->getTemplateId('home'), 'title' => \SpoonFilter::ucfirst($this->getLocale('Home', 'Core', $language, 'lbl', 'Backend')), 'language' => $language, 'allow_move' => 'N', 'allow_delete' => 'N'), null, array('html' => __DIR__ . '/Data/' . $language . '/sample1.txt'), array('extra_id' => $extras['blog_widget_recent_articles_list'], 'position' => 'left'), array('extra_id' => $extras['blog_widget_recent_comments'], 'position' => 'right'), array('extra_id' => $extras['search_form'], 'position' => 'top'));
                // blog
                $this->insertPage(array('title' => \SpoonFilter::ucfirst($this->getLocale('Blog', 'Core', $language, 'lbl', 'Frontend')), 'language' => $language), null, array('extra_id' => $extras['blog_block']), array('extra_id' => $extras['blog_widget_recent_comments'], 'position' => 'left'), array('extra_id' => $extras['blog_widget_categories'], 'position' => 'left'), array('extra_id' => $extras['blog_widget_archive'], 'position' => 'left'), array('extra_id' => $extras['blog_widget_recent_articles_list'], 'position' => 'left'), array('extra_id' => $extras['search_form'], 'position' => 'top'));
                // about us parent
                $aboutUsId = $this->insertPage(array('title' => \SpoonFilter::ucfirst($this->getLocale('AboutUs', 'Core', $language, 'lbl', 'Frontend')), 'parent_id' => 1, 'language' => $language), null, array('extra_id' => $extras['subpages_widget']), array('extra_id' => $extras['search_form'], 'position' => 'top'));
                // location
                $this->insertPage(array('title' => \SpoonFilter::ucfirst($this->getLocale('Location', 'Core', $language, 'lbl', 'Frontend')), 'parent_id' => $aboutUsId, 'language' => $language), null, array('html' => __DIR__ . '/Data/' . $language . '/sample1.txt'), array('html' => __DIR__ . '/Data/' . $language . '/sample2.txt'), array('extra_id' => $extras['search_form'], 'position' => 'top'));
                // about us child
                $this->insertPage(array('title' => \SpoonFilter::ucfirst($this->getLocale('AboutUs', 'Core', $language, 'lbl', 'Frontend')), 'parent_id' => $aboutUsId, 'language' => $language), null, array('html' => __DIR__ . '/Data/' . $language . '/sample1.txt'), array('html' => __DIR__ . '/Data/' . $language . '/sample2.txt'), array('extra_id' => $extras['search_form'], 'position' => 'top'));
                // history
                $this->insertPage(array('title' => \SpoonFilter::ucfirst($this->getLocale('History', 'Core', $language, 'lbl', 'Frontend')), 'parent_id' => 1, 'language' => $language), null, array('html' => __DIR__ . '/Data/' . $language . '/sample1.txt'), array('html' => __DIR__ . '/Data/' . $language . '/sample2.txt'), array('extra_id' => $extras['search_form'], 'position' => 'top'));
                // insert lorem ipsum test page
                $this->insertPage(array('title' => 'Lorem ipsum', 'type' => 'root', 'language' => $language, 'hidden' => 'Y'), array('data' => array('seo_index' => 'noindex', 'seo_follow' => 'nofollow')), array('html' => __DIR__ . '/Data/' . $language . '/lorem_ipsum.txt'), array('extra_id' => $extras['search_form'], 'position' => 'top'));
            }
        }
    }