/**
  * @return string
  */
 protected function getEntryPointTemplate()
 {
     if ( $this->page )
     {
         if ($this->page->attribute('type') == MMStaticPage::TYPE_EMPTY_LAYOUT)
         {
             return 'esibuild/app_content/page/empty_view.tpl';
         }
         if ($this->page->attribute('type') == MMStaticPage::TYPE_CONTENT_ONLY)
         {
             return 'esibuild/app_content/page/content_only.tpl';
         }
     }
     return parent::getEntryPointTemplate();
 }
        CookieTool::destroyCookie( 'displayToUPPPopin' );
        CookieTool::destroyCookie( 'displayToUPPPopin', '/', null );
        CookieTool::destroyCookie( 'displayToUPPPage' );
        CookieTool::destroyCookie( 'displayToUPPPage', '/', null );
        echo json_encode( array( 'result' => 0 ) );
        eZExecution::cleanExit();
    }

    $service = ESBFactory::getUserService();
    $userProfile = $service->form();

    $touPage = MMStaticPage::fetchPageByInternalId( 'terms-of-use' );

    $privacyPolicyPageInternalId = SolrSafeOperatorHelper::feature( 'ToUPPPopin', 'shortPrivacyPolicyPageInternalId' );
    $privacyPolicyPageInternalId = ( $privacyPolicyPageInternalId === false || is_null( $privacyPolicyPageInternalId ) || trim( $privacyPolicyPageInternalId ) == "" ) ? 'privacy-policy' : $privacyPolicyPageInternalId;
    $ppPage  = MMStaticPage::fetchPageByInternalId( $privacyPolicyPageInternalId );

    $currentToUConsentVersion       = SolrSafeOperatorHelper::feature( 'ToUPPPopin', 'currentToUConsentVersion' );
    $currentPPConsentVersion        = SolrSafeOperatorHelper::feature( 'ToUPPPopin', 'currentPPConsentVersion' );
    $hasCheckbox                    = SolrSafeOperatorHelper::feature( 'ToUPPPopin', 'hasCheckbox' );
    $precheckedCheckbox             = SolrSafeOperatorHelper::feature( 'ToUPPPopin', 'precheckedCheckbox' );
    $adaptConsentText               = in_array( ClusterTool::clusterIdentifier(), array( 'cluster_uk' ) ) ? true : false;

    $touPPCheckboxFeatures = array(
        'hasToUCheckbox'        => SolrSafeOperatorHelper::feature( 'ToUPPPopin', 'hasToUCheckbox' ),
        'precheckedToUCheckbox' => SolrSafeOperatorHelper::feature( 'ToUPPPopin', 'precheckedToUCheckbox' ),
        'hasPPCheckbox'         => SolrSafeOperatorHelper::feature( 'ToUPPPopin', 'hasPPCheckbox' ),
        'precheckedPPCheckbox'  => SolrSafeOperatorHelper::feature( 'ToUPPPopin', 'precheckedPPCheckbox' ),
    );

    $optInFeatures = array(
    /**
     * Creates new MMStaticPage and associated blocks from old eZ static page
     *
     * @param string $url Url of new static page
     * @param string $clusterIdentifier Cluster identifier of new static page
     * @param string $headline Headline of new static page (html)
     * @param string $content Core content of new static page (html)
     * @param arary $templates List of templates that will be converted into
     *                         "MMStaticPageBlock"s and associated with the new
     *                         static page.
     **/
    public function import( $url, $clusterIdentifier, $headline, $content, $templates )
    {
        $staticPage = new MMStaticPage();
        $staticPage->setAttribute( 'url', $url );
        $staticPage->setAttribute( 'cluster_identifier', $clusterIdentifier );

        // We don't export full headline HTML anymore, a simple headline
        // is created either by trying to parse the HTML or from the URL
        $pattern = "/<h2 class=\"title\">(.*?)<\/h2>/";
        preg_match($pattern, $headline, $matches);
        if(!is_null($matches[1]))
        {
            $staticPage->setAttribute( 'headline', $matches[1]);
        }
        else
        {
            $staticPage->setAttribute( 'headline', str_replace('-', ' ', ltrim( $url, '/' )) );
        }

        $staticPage->setAttribute( 'core_content', $content );
        $staticPage->setAttribute( 'environment', 1 );
        $staticPage->setAttribute( 'target_platform', 'WEB' );
        $staticPage->setAttribute( 'title', ltrim( $url, '/' ) );
        $staticPage->setAttribute( 'internal_id', uniqid() );

        $actionBar = array();
        if( strstr( $content, 'btn-back' ) )
        {
            $actionBar[] = 'BACK';
        }
        if( strstr( $content, 'btn-print' ) )
        {
            $actionBar[] = 'PRINT';
        }
        if( count( $actionBar ) > 0 )
        {
            $staticPage->setAttribute( 'action_bar', implode( ';', $actionBar ) );
        }

        $staticPage->store();

        foreach( $templates as $index => $template )
        {
            $block = $this->fetchOrCreateBlock( $template, $staticPage->ID );
            $blockRelation = new MMStaticPageBlockRelation();
            $blockRelation->setAttribute( 'static_page_id', $staticPage->ID );
            $blockRelation->setAttribute( 'static_block_id', $block->ID );
            $blockRelation->setAttribute( 'position', $index + 1 );
            $blockRelation->store();
        }
    }
 /**
  * Fetches the static page
  *
  * @return MMStaticPage or null
  **/
 protected function fetchStaticPage()
 {
     return MMStaticPage::fetch( $this->staticPageId );
 }