Sculpin\Core\Formatter\FormatterManager::buildBaseFormatContext PHP Method

buildBaseFormatContext() protected method

Build base format context
protected buildBaseFormatContext ( mixed $context ) : Dflydev\DotAccessConfiguration\Configuration
$context mixed
return Dflydev\DotAccessConfiguration\Configuration
    protected function buildBaseFormatContext($context)
    {
        $baseContext = new Configuration(array('site' => $this->siteConfiguration->export(), 'page' => $context, 'formatter' => $this->defaultFormatter, 'converters' => array()));
        if (isset($context['url'])) {
            if ('/' === $context['url']) {
                $relativeUrl = '.';
            } else {
                $relativeUrl = rtrim(str_repeat('../', substr_count($context['url'], '/')), '/');
            }
            $baseContext->set('relative_root_url', $relativeUrl);
        }
        foreach ($this->dataProviderManager->dataProviders() as $name) {
            if (isset($context['use']) && in_array($name, $context['use'])) {
                $baseContext->set('data.' . $name, $this->dataProviderManager->dataProvider($name)->provideData());
            }
        }
        return $baseContext;
    }