Classes/Page/Part/MetatagPart.php
protected function convertOpenGraphTypoScriptToMetaTags(array $prefixes, array $tsSetupSeoOg)
    {
        // Get list of tags (filtered array)
        $ogTagNameList = array_keys($tsSetupSeoOg);
        $ogTagNameList = array_unique(
            array_map(
                function ($item) {
                    return rtrim($item, '.');
                },
                $ogTagNameList
            )
        );

        foreach ($ogTagNameList as $ogTagName) {
            $ogTagValue = null;

            // Check if TypoScript value is a simple one (eg. title = foo)
            // or it is a cObject
            if (!empty($tsSetupSeoOg[$ogTagName]) && !array_key_exists($ogTagName . '.', $tsSetupSeoOg)) {
                // Simple value
                $ogTagValue = $tsSetupSeoOg[$ogTagName];
            } elseif (!empty($tsSetupSeoOg[$ogTagName])) {
                // Content object (eg. TEXT)
                $ogTagValue = $this->cObj->cObjGetSingle(
                    $tsSetupSeoOg[$ogTagName],
                    $tsSetupSeoOg[$ogTagName . '.']
                );
            } elseif (!array_key_exists($ogTagName, $tsSetupSeoOg) && array_key_exists($ogTagName . '.', $tsSetupSeoOg)) {
                // Nested object (e.g. image)
                array_push($prefixes, $ogTagName);
                $this->convertOpenGraphTypoScriptToMetaTags($prefixes, $tsSetupSeoOg[$ogTagName . '.']);
                array_pop($prefixes);
            }

            if ($ogTagValue !== null && strlen($ogTagValue) >= 1) {
                $path = $prefixes;
                $path[] = $ogTagName;
                $this->metaTagList[implode('.', $path)] = array(
                    'tag'        => 'meta',
                    'attributes' => array(
                        'property' => implode(':', $path),
                        'content'  => $ogTagValue,
                    ),
                );
            }
        }
    }
protected function convertOpenGraphTypoScriptToMetaTags(array $prefixes, array $tsSetupSeoOg)
    {
        // Get list of tags (filtered array)
        $ogTagNameList = array_keys($tsSetupSeoOg);
        $ogTagNameList = array_unique(
            array_map(
                function ($item) {
                    return rtrim($item, '.');
                },
                $ogTagNameList
            )
        );

        foreach ($ogTagNameList as $ogTagName) {
            $ogTagValue = null;

            // Check if TypoScript value is a simple one (eg. title = foo)
            // or it is a cObject
            if (!empty($tsSetupSeoOg[$ogTagName]) && !array_key_exists($ogTagName . '.', $tsSetupSeoOg)) {
                // Simple value
                $ogTagValue = $tsSetupSeoOg[$ogTagName];
            } elseif (!empty($tsSetupSeoOg[$ogTagName])) {
                // Content object (eg. TEXT)
                $ogTagValue = $this->cObj->cObjGetSingle(
                    $tsSetupSeoOg[$ogTagName],
                    $tsSetupSeoOg[$ogTagName . '.']
                );
            } elseif (!array_key_exists($ogTagName, $tsSetupSeoOg) && array_key_exists($ogTagName . '.', $tsSetupSeoOg)) {
                // Nested object (e.g. image)
                array_push($prefixes, $ogTagName);
                $this->convertOpenGraphTypoScriptToMetaTags($prefixes, $tsSetupSeoOg[$ogTagName . '.']);
                array_pop($prefixes);
            }

            if ($ogTagValue !== null && strlen($ogTagValue) >= 1) {
                $path = $prefixes;
                $path[] = $ogTagName;
                $this->metaTagList[implode('.', $path)] = array(
                    'tag'        => 'meta',
                    'attributes' => array(
                        'property' => implode(':', $path),
                        'content'  => $ogTagValue,
                    ),
                );
            }
        }
    }
protected function convertOpenGraphTypoScriptToMetaTags ( array $ prefixes , array $ tsSetupSeoOg ) { // Get list of tags (filtered array) $ ogTagNameList = array_keys ( $ tsSetupSeoOg ) ; $ ogTagNameList = array_unique ( array_map ( function ( $ item ) { return rtrim ( $ item , '.' ) ; } , $ ogTagNameList ) ) ; foreach ( $ ogTagNameList as $ ogTagName ) { $ ogTagValue = null ; // Check if TypoScript value is a simple one (eg. title = foo) // or it is a cObject if ( ! empty ( $ tsSetupSeoOg [ $ ogTagName ] ) && ! array_key_exists ( $ ogTagName . '.' , $ tsSetupSeoOg ) ) { // Simple value $ ogTagValue = $ tsSetupSeoOg [ $ ogTagName ] ; } elseif ( ! empty ( $ tsSetupSeoOg [ $ ogTagName ] ) ) { // Content object (eg. TEXT) $ ogTagValue = $ this -> cObj -> cObjGetSingle ( $ tsSetupSeoOg [ $ ogTagName ] , $ tsSetupSeoOg [ $ ogTagName . '.' ] ) ; } elseif ( ! array_key_exists ( $ ogTagName , $ tsSetupSeoOg ) && array_key_exists ( $ ogTagName . '.' , $ tsSetupSeoOg ) ) { // Nested object (e.g. image) array_push ( $ prefixes , $ ogTagName ) ; $ this -> convertOpenGraphTypoScriptToMetaTags ( $ prefixes , $ tsSetupSeoOg [ $ ogTagName . '.' ] ) ; array_pop ( $ prefixes ) ; } if ( $ ogTagValue !== null && strlen ( $ ogTagValue ) >= 1 ) { $ path = $ prefixes ; $ path [ ] = $ ogTagName ; $ this -> metaTagList [ implode ( '.' , $ path ) ] = array ( 'tag' => 'meta' , 'attributes' => array ( 'property' => implode ( ':' , $ path ) , 'content' => $ ogTagValue , ) , ) ; } } }
Convert nested TypoScript to OpenGraph MetaTags

@param array $prefixes
@param array $tsSetupSeoOg
Convert nested TypoScript to OpenGraph MetaTags