Uzi AreaGames Posted March 7, 2018 Posted March 7, 2018 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?
Adriano Faria Posted March 7, 2018 Posted March 7, 2018 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' ) ) );
Uzi AreaGames Posted March 7, 2018 Author Posted March 7, 2018 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.
Adriano Faria Posted March 7, 2018 Posted March 7, 2018 Add a comment in the field and try again to see if the field is the issue.
Uzi AreaGames Posted March 7, 2018 Author Posted March 7, 2018 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 ?
Adriano Faria Posted March 7, 2018 Posted March 7, 2018 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; } ) ) );
Uzi AreaGames Posted March 7, 2018 Author Posted March 7, 2018 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
Uzi AreaGames Posted March 9, 2018 Author Posted March 9, 2018 @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} }
bfarber Posted March 12, 2018 Posted March 12, 2018 It's returning the actual node (what you are seeing is the json representation of the object). What you want to do is save $returnedValue->_id and use that later.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.