Craft\SeomaticTwigExtension::renderJSONLD PHP Méthode

renderJSONLD() public méthode

PHP: $myJSONLD = array( "type" => "Corporation", "name" => "nystudio107", "sameAs" => ["https://Twitter.com/nystudio107","https://plus.google.com/+nystudio107"], "address" => array( "type" => 'PostalAddress', "addressCountry" => "USA", ), ); Twig: {% set myJSONLD = { "type": "Corporation", "name": "nystudio107", "sameAs": ["https://Twitter.com/nystudio107","https://plus.google.com/+nystudio107"], "address": { "type": 'PostalAddress', "addressCountry": "USA", }, } %} The array can be nested arbitrarily deep with sub-arrays. The first key in the array, and in each sub-array, should be an "type" with a valid Schema.org type as the value. Because Twig doesn't support array keys with non-alphanumeric characters, SEOmatic transforms the keys "type" into "@type" at render time. --------------------------------------------------------------------------------
public renderJSONLD ( $object = [] )
    public function renderJSONLD($object = array())
    {
        craft()->seomatic->sanitizeArray($object);
        $result = craft()->seomatic->renderJSONLD($object);
        return TemplateHelper::getRaw(rtrim($result));
    }