protected function getMetaFields($objArticle)
    {
        $meta = deserialize($this->news_metaFields);

        if (!is_array($meta)) {
            return [];
        }

        $return = [];

        foreach ($meta as $field) {
            switch ($field) {
                case 'date':
                    /** @var Date $dateAdapter */
                    $dateAdapter = $this->framework->getAdapter(Date::class);

                    $return['date'] = $dateAdapter->parse($GLOBALS['objPage']->datimFormat, $objArticle->date);
                    break;

                case 'author':
                    if (($objAuthor = $objArticle->getRelated('author')) !== null) {
                        if (!empty($objAuthor->google)) {
                            $return['author'] = $GLOBALS['TL_LANG']['MSC']['by'] .
                                ' <a href="https://plus.google.com/' . $objAuthor->google .
                                '" rel="author" target="_blank">' . $objAuthor->name . '</a>';
                        } else {
                            $return['author'] = $GLOBALS['TL_LANG']['MSC']['by'] . ' ' . $objAuthor->name;
                        }
                    }
                    break;

                case 'comments':
                    if ($objArticle->noComments || $objArticle->source !== 'default') {
                        break;
                    }

                    /** @var CommentsModel $commentsModelAdapter */
                    $commentsModelAdapter = $this->framework->getAdapter(CommentsModel::class);

                    $intTotal           = $commentsModelAdapter->countPublishedBySourceAndParent(
                        'tl_news',
                        $objArticle->id
                    );
                    $return['ccount']   = $intTotal;
                    $return['comments'] = sprintf($GLOBALS['TL_LANG']['MSC']['commentCount'], $intTotal);
                    break;
                default:
            }
        }

        return $return;
    }
protected function getMetaFields($objArticle)
    {
        $meta = deserialize($this->news_metaFields);

        if (!is_array($meta)) {
            return [];
        }

        $return = [];

        foreach ($meta as $field) {
            switch ($field) {
                case 'date':
                    /** @var Date $dateAdapter */
                    $dateAdapter = $this->framework->getAdapter(Date::class);

                    $return['date'] = $dateAdapter->parse($GLOBALS['objPage']->datimFormat, $objArticle->date);
                    break;

                case 'author':
                    if (($objAuthor = $objArticle->getRelated('author')) !== null) {
                        if (!empty($objAuthor->google)) {
                            $return['author'] = $GLOBALS['TL_LANG']['MSC']['by'] .
                                ' <a href="https://plus.google.com/' . $objAuthor->google .
                                '" rel="author" target="_blank">' . $objAuthor->name . '</a>';
                        } else {
                            $return['author'] = $GLOBALS['TL_LANG']['MSC']['by'] . ' ' . $objAuthor->name;
                        }
                    }
                    break;

                case 'comments':
                    if ($objArticle->noComments || $objArticle->source !== 'default') {
                        break;
                    }

                    /** @var CommentsModel $commentsModelAdapter */
                    $commentsModelAdapter = $this->framework->getAdapter(CommentsModel::class);

                    $intTotal           = $commentsModelAdapter->countPublishedBySourceAndParent(
                        'tl_news',
                        $objArticle->id
                    );
                    $return['ccount']   = $intTotal;
                    $return['comments'] = sprintf($GLOBALS['TL_LANG']['MSC']['commentCount'], $intTotal);
                    break;
                default:
            }
        }

        return $return;
    }
protected function getMetaFields ( $ objArticle ) { $ meta = deserialize ( $ this -> news_metaFields ) ; if ( ! is_array ( $ meta ) ) { return [ ] ; } $ return = [ ] ; foreach ( $ meta as $ field ) { switch ( $ field ) { case 'date' : /** @var Date $dateAdapter */ $ dateAdapter = $ this -> framework -> getAdapter ( Date :: class ) ; $ return [ 'date' ] = $ dateAdapter -> parse ( $ GLOBALS [ 'objPage' ] -> datimFormat , $ objArticle -> date ) ; break ; case 'author' : if ( ( $ objAuthor = $ objArticle -> getRelated ( 'author' ) ) !== null ) { if ( ! empty ( $ objAuthor -> google ) ) { $ return [ 'author' ] = $ GLOBALS [ 'TL_LANG' ] [ 'MSC' ] [ 'by' ] . ' <a href="https://plus.google.com/' . $ objAuthor -> google . '" rel="author" target="_blank">' . $ objAuthor -> name . '</a>' ; } else { $ return [ 'author' ] = $ GLOBALS [ 'TL_LANG' ] [ 'MSC' ] [ 'by' ] . ' ' . $ objAuthor -> name ; } } break ; case 'comments' : if ( $ objArticle -> noComments || $ objArticle -> source !== 'default' ) { break ; } /** @var CommentsModel $commentsModelAdapter */ $ commentsModelAdapter = $ this -> framework -> getAdapter ( CommentsModel :: class ) ; $ intTotal = $ commentsModelAdapter -> countPublishedBySourceAndParent ( 'tl_news' , $ objArticle -> id ) ; $ return [ 'ccount' ] = $ intTotal ; $ return [ 'comments' ] = sprintf ( $ GLOBALS [ 'TL_LANG' ] [ 'MSC' ] [ 'commentCount' ] , $ intTotal ) ; break ; default : } } return $ return ; }
Return the meta fields of a news article as array.

@param NewsModel $objArticle The model.

@return array

@SuppressWarnings(PHPMD.CyclomaticComplexity)
@SuppressWarnings(PHPMD.Superglobals)
@SuppressWarnings(PHPMD.CamelCaseVariableName)
Return the meta fields of a news article as array .