Jump to content

Node form helper


Recommended Posts

Posted

Hi there, i'm trying to develop a plugin where the admin needs to set a forum id, and i wonder if i could do a select list like the one from when you create a new forum ( or edit one ).

From what i've seen in the files of the Forums app i need the node form helper but i don't quite understand it. Could someone help me out? :) 

Posted

Example:

$form->add( new \IPS\Helpers\Form\Node( 'your_setting', \IPS\Settings::i()->your_setting ? \IPS\Settings::i()->your_setting : 0, FALSE, array( 'class' => '\IPS\forums\Forum', 'permissionCheck' => 'view' ) ) );

 

Posted

Something seems to be wrong, when i try to edit the settings of the pluing i get this error:

There is an error in the plugin and it could not be loaded. Contact the author for further assistance.

 

Posted

I've done some quick testing. And looks like yes it's it. Not only that but even after i comment it my plugin is still broken, so i deleted it and done another one, same result, after using your code it broke, and after commenting it and replacing with a simple text field still not working, but using a text field before using your code does it fine, but still i would love that node ? 

Posted

Another example:

$form->add( new \IPS\Helpers\Form\Node( 'your_setting', \IPS\Settings::i()->your_setting, TRUE, array( 'class' => 'IPS\forums\Forum', 'permissionCheck' => function ( $forum )
{
	return $forum->sub_can_post and !$forum->redirect_url;
}
) ) );

xRJTsb3.png

Posted

Nope it still doesn't work for some reason, i'm going to try a clean reinstall. Because i've been playing with the dev mode so much... Coming back with an edit.

Edit: Looks like there was some weird invisible spacing before the $form variable, literally they where invisible, i just figured it out randomly lol, thanks for the help :) 

 

Posted

@Adriano Faria One last thing about this, i switched to building a app since it felt better for what i want to do and opened more doors, i still need to use a node form helper but this time when i get the value of it it returns an array which looks like this in json: 

{ "noCopyButton": false,"_followData":null, "changed":[], "skipCloneDuplication":false }

What i've observed is that if i give the option to select mutiple options the return will look something like this: 

{
	"8" : {"noCopyButton":false,"_followData":null,"changed":[],"skipCloneDuplication":false},
	"10": {"noCopyButton":false,"_followData":null,"changed":[],"skipCloneDuplication":false}
}

 

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...