We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3177
    • 137 Posts
    Hello,

    In the function "efLoadTemplate" (line 1056 in latest version)
    the chunk is called, and if the chunk doesn’t exist, a snippet
    with the same name is called.

    I would like to see that the snippet call also passes $params
    in the second param. The ’$params’ is taken from the call of
    of eForm snippet.
    This way developers can pass extra params which will be ignored
    by eForm but passed on to possible snippets called by eForm.

    My guess is that the function should look like:
    
    function efLoadTemplate($key){
    	global $modx;
    	global $params; // MODIFIED : Get the params passed to this snippet
    	if( strlen($key)>50 ) return $key;
    	$tpl = false;
    	if( is_numeric($key) ) { //get from document id
    		//try unpublished docs first
    		$tpl = ( $doc=$modx->getDocument($key,'content',0) )? $doc['content'] :false;
    		if(!$tpl )
    			$tpl = ( $doc=$modx->getDocument($key,'content',1) )? $doc['content'] : false;
    
    	}elseif( $key ){
    		$tpl = ( $doc=$modx->getChunk($key) )? $doc : false;
    		//try snippet if chunk is not found
    		// MODIFIED: Pass the params on to the next snippet.
            if(!$tpl) $tpl = ( $doc=$modx->runSnippet($key, $params) )? $doc : false;   
    	}
    	return $tpl;
    }
    


    The reasons for this wish are too extensive to write down here. (Think of
    dynamic images showing/hiding specific forms, all with one eForm)

    Hope you can consider this.

    Thanks,

    Bert Catsburg