Craft\SeomaticPlugin::init PHP Метод

init() публичный Метод

public init ( )
    public function init()
    {
        require_once __DIR__ . '/vendor/autoload.php';
        craft()->templates->hook('seomaticRender', function (&$context) {
            if (craft()->request->isSiteRequest() && isset($context['seomaticMeta'])) {
                $locale = craft()->language;
                $seomaticMeta = $context['seomaticMeta'];
                $seomaticSiteMeta = $context['seomaticSiteMeta'];
                $seomaticIdentity = $context['seomaticIdentity'];
                $seomaticSocial = $context['seomaticSocial'];
                $seomaticCreator = $context['seomaticCreator'];
                $seomaticHelper = $context['seomaticHelper'];
                /* -- We want to pass an up-to-date variable context to the template, so pass everything on in */
                $result = "";
                $metaVars = array('seomaticMeta' => $seomaticMeta, 'seomaticSiteMeta' => $seomaticSiteMeta, 'seomaticIdentity' => $seomaticIdentity, 'seomaticSocial' => $seomaticSocial, 'seomaticCreator' => $seomaticCreator, 'seomaticHelper' => $seomaticHelper);
                /* -- Main Entity of Page info, which is optional */
                if (isset($context['seomaticMainEntityOfPage'])) {
                    $metaVars['seomaticMainEntityOfPage'] = $context['seomaticMainEntityOfPage'];
                }
                /* -- Render the seomaticMeta, this is where the magic happens */
                $seomaticTemplatePath = '';
                if (isset($context['seomaticTemplatePath'])) {
                    $seomaticTemplatePath = $context['seomaticTemplatePath'];
                }
                $result = craft()->seomatic->renderSiteMeta($seomaticTemplatePath, $metaVars, $locale);
                return $result;
            }
        });
    }