Return vars passed to theme. Those vars will be added to block context.

@param DataSourceViewInterface $dataSource
@return array
14803
private function getVars(DataSourceViewInterface $dataSource)
    {
        return isset($this->themesVars[$dataSource->getName()])
            ? $this->themesVars[$dataSource->getName()]
            : []
        ;
    }
881351
protected function getJSTemplateVars($vars)
    {
        if (is_array($vars)) {
            return $vars;
        }
        
        if ($this->hasMethod($vars)) {
            return $this->{$vars}();
        }
        
        return [];
    }
1040046
private function loadGlobalVar(string $name, string $source = ''): array
    {
        $encode = false;

        switch ($name) {
            case 'GET':
                $source = $_SERVER['QUERY_STRING'] ?? '';
                $encode = true;
                break;
            case 'POST': // pass
                break;
            case 'COOKIE':
                if (isset($_SERVER['HTTP_COOKIE'])) {
                    $source = implode('&', array_map('trim', explode(';', $_SERVER['HTTP_COOKIE'])));
                }
                break;
        }

        return Util::parseQueryString($source, $encode);
    }
264179
public function prepareDataSource(array $dataSource)
    {
        if (isset($dataSource['data']['items'])) {
            $config = $this->getConfiguration();
            $name   = $config['fieldName'] ?? $this->getName();
            foreach ($dataSource['data']['items'] as & $item) {
                $item[$name] = ($item[$name] ? __('Yes') : __('No'));
            }
        }

        return parent::prepareDataSource($dataSource);
    }
137714
public static function normalizeDataSource($dataSource, $basePath = null)
    {
        if (!empty($basePath) && !Utils::isHttpSource($dataSource)) {
            // TODO: support JSON pointers
            $absPath = $basePath.DIRECTORY_SEPARATOR.$dataSource;
            if (file_exists($absPath)) {
                $dataSource = $absPath;
            }
        }

        return $dataSource;
    }
551261
protected function getDataStream($dataSource, $dataSourceOptions = null)
    {
        return new DefaultDataStream($this->normalizeDataSource($dataSource, $this->basePath), $dataSourceOptions);
    }
80021
public function getVariableRefs()
	{
		$variableRefs = array();

		foreach ( $this->filters as $filter )
		{
			$variableRefs = array_merge( $variableRefs, $filter->getVariableRefs() );
		}

		return $variableRefs;
	}
752226
public function getSource(OperationContextInterface $context = null)
    {
        $sourceId = $this->getSourceId();
        if ($sourceId === null) {
            return null;
        }
        $context = $this->ensureContext($context);

        return $this->getSession()->getObject($sourceId, $context);
    }
148474
protected function _getTemplateVars() {
        $vars = array(
            'default_backend'   => $this->_getDefaultBackend(),
            'admin_backend'     => $this->_getAdminBackend(),
            'admin_frontname'   => $this->_getAdminFrontname(),
            'normalize_host_target' => $this->_getNormalizeHostTarget(),
            'url_base_regex'    => $this->getBaseUrlPathRegex(),
            'allowed_hosts_regex'   => $this->getAllowedHostsRegex(),
            'url_excludes'  => $this->_getUrlExcludes(),
            'get_param_excludes'    => $this->_getGetParamExcludes(),
            'get_param_ignored' => $this->_getIgnoreGetParameters(),
            'default_ttl'   => $this->_getDefaultTtl(),
            'enable_get_excludes'   => ($this->_getGetParamExcludes() ? 'true' : 'false'),
            'enable_get_ignored' => ($this->_getIgnoreGetParameters() ? 'true' : 'false'),
            'send_unmodified_url' => ($this->_sendUnModifiedUrlToBackend() ? 'true' : 'false'),
            'debug_headers' => $this->_getEnableDebugHeaders(),
            'grace_period'  => $this->_getGracePeriod(),
            'force_cache_static'    => $this->_getForceCacheStatic(),
            'simple_hash_static'    => $this->_getSimpleHashStatic(),
            'generate_session_expires'    => $this->_getGenerateSessionExpires(),
            'generate_session'    => $this->_getGenerateSession(),
            'generate_session_start'    => $this->_getGenerateSessionStart(),
            'generate_session_end'    => $this->_getGenerateSessionEnd(),
            'static_extensions' => $this->_getStaticExtensions(),
            'static_ttl'    => $this->_getStaticTtl(),
            'url_ttls'      => $this->_getUrlTtls(),
            'enable_caching'    => $this->_getEnableCaching(),
            'crawler_acl'   => $this->_vcl_acl('crawler_acl',
                $this->_getCrawlerIps()),
            'esi_cache_type_param'  =>
                Mage::helper('turpentine/esi')->getEsiCacheTypeParam(),
            'esi_method_param'  =>
                Mage::helper('turpentine/esi')->getEsiMethodParam(),
            'esi_ttl_param' => Mage::helper('turpentine/esi')->getEsiTtlParam(),
            'secret_handshake'  => Mage::helper('turpentine/varnish')
                ->getSecretHandshake(),
            'crawler_user_agent_regex'  => $this->_getCrawlerUserAgents(),
            // 'lru_factor'    => $this->_getLruFactor(),
            'debug_acl'     => $this->_vcl_acl('debug_acl',
                $this->_getDebugIps()),
            'custom_c_code' => file_get_contents(
                $this->_getVclTemplateFilename(self::VCL_CUSTOM_C_CODE_FILE) ),
            'esi_private_ttl'   => Mage::helper('turpentine/esi')
                ->getDefaultEsiTtl(),
        );

        if ((bool) Mage::getStoreConfig('turpentine_vcl/urls/bypass_cache_store_url')) {
            $vars['allowed_hosts'] = $this->_vcl_sub_allowed_hosts_regex();
        }

        if (Mage::getStoreConfig('turpentine_vcl/normalization/encoding')) {
            $vars['normalize_encoding'] = $this->_vcl_sub_normalize_encoding();
        }
        if (Mage::getStoreConfig('turpentine_vcl/normalization/user_agent')) {
            $vars['normalize_user_agent'] = $this->_vcl_sub_normalize_user_agent();
        }
        if (Mage::getStoreConfig('turpentine_vcl/normalization/host')) {
            $vars['normalize_host'] = $this->_vcl_sub_normalize_host();
        }
        if (Mage::getStoreConfig('turpentine_vcl/normalization/cookie_regex')) {
            $vars['normalize_cookie_regex'] = $this->_getNormalizeCookieRegex();
        }
        if (Mage::getStoreConfig('turpentine_vcl/normalization/cookie_target')) {
            $vars['normalize_cookie_target'] = $this->_getNormalizeCookieTarget();
        }

        if (Mage::getStoreConfig('turpentine_vcl/maintenance/enable')) {
            // in vcl_recv set the allowed IPs otherwise load the vcl_error (v3)/vcl_synth (v4)
            $vars['maintenance_allowed_ips'] = $this->_vcl_sub_maintenance_allowed_ips();
            // set the vcl_error from Magento database
            $vars['vcl_synth'] = $this->_vcl_sub_synth();
        }

        if (Mage::getStoreConfig('turpentine_varnish/general/https_proto_fix')) {
            $vars['https_proto_fix'] = $this->_vcl_sub_https_proto_fix();
        }
        
        if (Mage::getStoreConfig('turpentine_varnish/general/https_redirect_fix')) {
            $vars['https_redirect'] = $this->_vcl_sub_https_redirect_fix();
            if (Mage::getStoreConfig('turpentine_varnish/servers/version') == '4.0' || Mage::getStoreConfig('turpentine_varnish/servers/version') == '4.1') {
                $vars['vcl_synth'] = $this->_vcl_sub_synth_https_fix();
            }
        }

        foreach (array('', 'top') as $position) {
            $customIncludeFile = $this->_getCustomIncludeFilename($position);
            if (is_readable($customIncludeFile)) {
                $key = 'custom_vcl_include';
                $key .= ($position) ? '_'.$position : '';
                $vars[$key] = file_get_contents($customIncludeFile);
            }
        }

        return $vars;
    }
931265
public static DataSourceConfiguration getDataSourceConfiguration(final DataSource dataSource) {
        DataSourceConfiguration result = new DataSourceConfiguration(dataSource.getClass().getName());
        result.getProperties().putAll(findAllGetterProperties(dataSource));
        return result;
    }
172914
public function read(array $dataSource)
    {
        $data = $errors = [];

        foreach ($this->readers as $name => $reader) {
            try {
                $data[$name] = $reader->getValue($dataSource);
            } catch (MetadataReaderNotFoundException $e) {
                $errors[$name] = $e->getMessage();
            }
        }

        if (! empty($errors)) {
            foreach ($errors as $name => $error) {
                \common_Logger::d('Error on injector "' . __CLASS__ . '" with reader "' . $name . '" : ' . $error);
            }
            throw new MetadataInjectorReadException(
                'Injector "' . __CLASS__ . '" cannot read all required values from readers: ' . implode(', ', array_keys($errors))
            );
        }

        return $data;
    }
1336605
public function prepareDataSource(array $dataSource)
    {
        if (isset($dataSource['data']['items'])) {
            $storeId = $this->context->getFilterParam('store_id');

            foreach ($dataSource['data']['items'] as &$item) {
                $item[$this->getData('name')]['edit'] = [
                    'href' => $this->urlBuilder->getUrl(
                        'dotdigitalgroup_email/rules/edit',
                        ['id' => $item['id'], 'store' => $storeId]
                    ),
                    'label' => __('Edit'),
                    'hidden' => false,
                ];
            }
        }

        return $dataSource;
    }
540430
protected function getDatasource(ListenerAccessibleInterface $modelName) {

        /**
         * CP-251 - added multiple datasources to a single function. Need to check
         * for requested modelName before defaulting to datasourceKey which is
         * specified in default routing config.
         */
        if (is_object($modelName) && array_key_exists($modelName->getTablename(), $this->datasources)) {
            $datasource = $this->datasourceFactory->getDatasource($this->datasources[$modelName->getTablename()], $this->logger);
            $datasource->setDatasourceKey($this->datasources[$modelName->getTablename()]);
        } elseif (!is_object($modelName) && array_key_exists($modelName, $this->datasources)) {
            $datasource = $this->datasourceFactory->getDatasource($this->datasources[$modelName], $this->logger);
            $datasource->setDatasourceKey($this->datasources[$modelName]);
        } elseif (!is_null($this->datasourceKey)) {
            $datasource = $this->datasourceFactory->getDatasource($this->datasourceKey, $this->logger);
            $datasource->setDatasourceKey($this->datasourceKey);
        } else {
            throw new \Exception($modelName . ' datasource key missing from listeners configuration');
        }

        return $datasource;
    }
517891
public function getResourcePermissions(ResourceInterface $resource) : array
    {
        $query = $this->getRepository()->createQueryBuilder('r')
            ->select('r')
            ->where('r.resource_class = :resourceClass AND r.resource_id=:resourceId')
            ->setParameter('resourceClass', $resource->getClass())
            ->setParameter('resourceId', $resource->getId())
            ->getQuery();

        return $query->getResult();
    }
1073668
protected function getTemplatesSettings(ContainerInterface $container): array
    {
        $tplConfig = $container->get(SettingsProviderInterface::class)->get(TemplatesSettings::class);

        return $tplConfig;
    }
396365
public function setTheme(DataSourceViewInterface $dataSource, $theme, array $vars = [])
    {
        $this->themes[$dataSource->getName()] = ($theme instanceof Twig_Template)
            ? $theme
            : $this->environment->loadTemplate($theme);
        $this->themesVars[$dataSource->getName()] = $vars;
    }
473658
public function getVariableFromMaps($var, TransientVarsInterface $transientVars, PropertySetInterface $ps)
    {
        $firstDot = strpos($var, '.');
        $actualVar = $var;

        if (false !== $firstDot) {
            $actualVar = substr($var, 0, $firstDot);
        }


        $o = null;
        if ($transientVars->offsetExists($actualVar)) {
            $o = $transientVars->offsetGet($actualVar);
        }

        if (null === $o) {
            $o = $ps->getAsActualType($actualVar);
        }

        if (false !== $firstDot) {
            $property = substr($var, $firstDot + 1);
            $o = $this->getPropertyObject($o, $property);
        }

        return $o;
    }