src/Service/SnippetHelperServiceFactory.php
protected function configureSnippetHelper(SnippetHelper $snippetHelper, array $config, array $snippetsConfig)
    {
        $enableAll = isset($snippetsConfig['enable_all']) ?
            (bool)$snippetsConfig['enable_all'] :
            true;

        foreach ($snippetsConfig['snippets'] as $name => $snippetsConfig) {

            $values = [];

            // Retrive values from global config if a config key was provided
            if (isset($snippetsConfig['config_key']) && isset($config[$snippetsConfig['config_key']])) {
                $values = $config[$snippetsConfig['config_key']];
            }

            // Merge provided values, if any
            if (isset($snippetsConfig['values'])) {
                $values = array_merge_recursive($values, $snippetsConfig['values']);
            }

            $snippetHelper->appendSnippet(
                $name,
                isset($snippetsConfig['template']) ? $snippetsConfig['template'] : 'hanger-snippet/' . $name,
                $values,
                isset($snippetsConfig['placement']) ? $snippetsConfig['placement'] : null,
                isset($snippetsConfig['enabled']) ? $snippetsConfig['enabled'] : $enableAll
            );
        }

        return $snippetHelper;
    }
protected function configureSnippetHelper(SnippetHelper $snippetHelper, array $config, array $snippetsConfig)
    {
        $enableAll = isset($snippetsConfig['enable_all']) ?
            (bool)$snippetsConfig['enable_all'] :
            true;

        foreach ($snippetsConfig['snippets'] as $name => $snippetsConfig) {

            $values = [];

            // Retrive values from global config if a config key was provided
            if (isset($snippetsConfig['config_key']) && isset($config[$snippetsConfig['config_key']])) {
                $values = $config[$snippetsConfig['config_key']];
            }

            // Merge provided values, if any
            if (isset($snippetsConfig['values'])) {
                $values = array_merge_recursive($values, $snippetsConfig['values']);
            }

            $snippetHelper->appendSnippet(
                $name,
                isset($snippetsConfig['template']) ? $snippetsConfig['template'] : 'hanger-snippet/' . $name,
                $values,
                isset($snippetsConfig['placement']) ? $snippetsConfig['placement'] : null,
                isset($snippetsConfig['enabled']) ? $snippetsConfig['enabled'] : $enableAll
            );
        }

        return $snippetHelper;
    }
protected function configureSnippetHelper ( SnippetHelper $ snippetHelper , array $ config , array $ snippetsConfig ) { $ enableAll = isset ( $ snippetsConfig [ 'enable_all' ] ) ? ( bool ) $ snippetsConfig [ 'enable_all' ] : true ; foreach ( $ snippetsConfig [ 'snippets' ] as $ name => $ snippetsConfig ) { $ values = [ ] ; // Retrive values from global config if a config key was provided if ( isset ( $ snippetsConfig [ 'config_key' ] ) && isset ( $ config [ $ snippetsConfig [ 'config_key' ] ] ) ) { $ values = $ config [ $ snippetsConfig [ 'config_key' ] ] ; } // Merge provided values, if any if ( isset ( $ snippetsConfig [ 'values' ] ) ) { $ values = array_merge_recursive ( $ values , $ snippetsConfig [ 'values' ] ) ; } $ snippetHelper -> appendSnippet ( $ name , isset ( $ snippetsConfig [ 'template' ] ) ? $ snippetsConfig [ 'template' ] : 'hanger-snippet/' . $ name , $ values , isset ( $ snippetsConfig [ 'placement' ] ) ? $ snippetsConfig [ 'placement' ] : null , isset ( $ snippetsConfig [ 'enabled' ] ) ? $ snippetsConfig [ 'enabled' ] : $ enableAll ) ; } return $ snippetHelper ; }
Configure Snippet Helper
@param SnippetHelper $snippetHelper
@param array         $config
@param array         $snippetsConfig
@return SnippetHelper
Configure Snippet Helper