コード例 #1
0
    /**
     * @return array
     */
    public function getSocialInfos()
    {
        if( !($this->node instanceof eZContentObjectTreeNode)
            || $this->node->attribute('class_identifier') != 'article' )
            return array();

        /* @type eZContentObjectAttribute[] $dataMap */
        $dataMap     = $this->node->dataMap();
        $headline    = $dataMap["headline"]->content();
        $urlParams   = array();
        $description = "";
        $imageUrl    = "";
        $urlGet      = "";

        if ( ClusterTool::isTwoLangCluster() )
        {
            $urlParams['ll'] = SystemLocale::fetchByClusterAndSystem( ClusterTool::clusterIdentifier(), 'exact_target' );
        }

        if($dataMap["promo_description"]->hasContent())
        {
            $description = strip_tags($dataMap["promo_description"]->content());
        }

        if ( count($urlParams) > 0 )
        {
            $urlGet = '?' . http_build_query($urlParams);
        }

        if ( NodeOperatorHelper::hasImageArticle($this->node, ImageArticleTool::SLIDE_APPLICATION_CASE ) )
        {
            $imageUrl = SolrSafeOperatorHelper::getImageArticleUrl(
                ImageArticleTool::SLIDE_APPLICATION_CASE,
                $this->node->attribute('contentobject_id'),
                $this->node->currentLanguage(),
                'dt_full'
            );
            $imageUrl .= $urlGet;
        }

        return array(
            "title"       => $headline,
            "description" => $description,
            "url"         => $this->applicationName()."/".$this->node->remoteID().$urlGet,
            "imageUrl"    => $imageUrl
        );
    }