Twig/Extension/LayoutHelpersExtension.php
public function getParameter(\Twig_Environment $environment, $parameterName, $configAlias = null, $debug = false)
    {
    	$defaultConfig = $this->configManager->getRepository()->getDefaultConfiguration();
    	$this->config = count($defaultConfig) > 0 ? $defaultConfig[0] : null;
    	$parameters = array();

    	if ( $configAlias === null && $this->config !== null ) {
    		$params = $this->config->getParameters();
    	} elseif ( $this->config !== null ) {
    		$config = $this->configManager->getRepository()->findOneBy(array('alias' => $configAlias));
    		if ( $config === null ) {
    			throw new \Exception(sprintf('The configuration with name "%s" not found.', $configAlias));
    		}
    		$params = $config->getParameters();
    	}
    	
    	if ( !isset($params) ) {
    		return;
    	}
    	
   		foreach($params as $p) {
   			$parameters[$p->getName()] = $p->getValue();
   		}
    	
    	if ( $debug === true && !isset($parameters[$parameterName]) ) {
    		throw new \Exception(sprintf('The parameter with name "%s" not found.', $parameterName));
    	}
    	
        return isset($parameters[$parameterName]) ? $parameters[$parameterName] : '';
    }
public function getParameter(\Twig_Environment $environment, $parameterName, $configAlias = null, $debug = false)
    {
    	$defaultConfig = $this->configManager->getRepository()->getDefaultConfiguration();
    	$this->config = count($defaultConfig) > 0 ? $defaultConfig[0] : null;
    	$parameters = array();

    	if ( $configAlias === null && $this->config !== null ) {
    		$params = $this->config->getParameters();
    	} elseif ( $this->config !== null ) {
    		$config = $this->configManager->getRepository()->findOneBy(array('alias' => $configAlias));
    		if ( $config === null ) {
    			throw new \Exception(sprintf('The configuration with name "%s" not found.', $configAlias));
    		}
    		$params = $config->getParameters();
    	}
    	
    	if ( !isset($params) ) {
    		return;
    	}
    	
   		foreach($params as $p) {
   			$parameters[$p->getName()] = $p->getValue();
   		}
    	
    	if ( $debug === true && !isset($parameters[$parameterName]) ) {
    		throw new \Exception(sprintf('The parameter with name "%s" not found.', $parameterName));
    	}
    	
        return isset($parameters[$parameterName]) ? $parameters[$parameterName] : '';
    }
public function getParameter ( \ Twig_Environment $ environment , $ parameterName , $ configAlias = null , $ debug = false ) { $ defaultConfig = $ this -> configManager -> getRepository ( ) -> getDefaultConfiguration ( ) ; $ this -> config = count ( $ defaultConfig ) > 0 ? $ defaultConfig [ 0 ] : null ; $ parameters = array ( ) ; if ( $ configAlias === null && $ this -> config !== null ) { $ params = $ this -> config -> getParameters ( ) ; } elseif ( $ this -> config !== null ) { $ config = $ this -> configManager -> getRepository ( ) -> findOneBy ( array ( 'alias' => $ configAlias ) ) ; if ( $ config === null ) { throw new \ Exception ( sprintf ( 'The configuration with name "%s" not found.' , $ configAlias ) ) ; } $ params = $ config -> getParameters ( ) ; } if ( ! isset ( $ params ) ) { return ; } foreach ( $ params as $ p ) { $ parameters [ $ p -> getName ( ) ] = $ p -> getValue ( ) ; } if ( $ debug === true && ! isset ( $ parameters [ $ parameterName ] ) ) { throw new \ Exception ( sprintf ( 'The parameter with name "%s" not found.' , $ parameterName ) ) ; } return isset ( $ parameters [ $ parameterName ] ) ? $ parameters [ $ parameterName ] : '' ; }
Return the website configuration parameter value
Return the website configuration parameter value