Page 1 of 1

CreateLink function [solved] nevermind? (sorry)

Posted: Mon Oct 05, 2009 2:12 am
by j88per
I'm trying to figure something out regarding the CreateLink function and hope  someone can help.  I am calling the CreateLink at the bottom of an admin tab to add new data to a table.  However when the CreateLink is called, I get the XHMTL link, but also an error as follows:

Code: Select all

Warning: Invalid argument supplied for foreach() in /srv/www/htdocs/site2/lib/classes/module_support/modform.inc.php on line 456 
Some digging seems to be that the params field isn't formatted properly as an array.  However, the way I'm calling the CreateLink, I don't need or want any params - just a straight link. 

Code: Select all

$smarty->assign('createlink', $this->CreateLink($id, 'addcategory', $returnid, 'Add Category', '', '', '', '', '', '', ''); 
I don't need or want any more than this, no icons, no parameters, etc.  I know I can add more, but I'm just in preliminary stages of developing a module and don't want to spend time on aesthetics as opposed to bug free operation.

I notice in the modform class/function that $params is being set to an array, but still this fails.  I can put a test prior to line 456 as such and it goes away, but seems odd.

Code: Select all

 if(!empty($params)){
I am looking at the CMSMS API but it isn't really helping much here either...

- answered my own problem, but could this be a bug?  or undocumented feature?
Solution - It appears that the params field is required in the CreateLink function, even if you just put array() in there it works.   I'll still post this to help others.