rzda Posted April 12, 2018 Share Posted April 12, 2018 Hello, I'm trying to create a plugin and I want to add some settings to it. I want to add those 2 settings to work something like this But I don't know what code I should add to "Content" because it's seems the {lang= it doesn't work. Link to comment Share on other sites More sharing options...
opentype Posted April 12, 2018 Share Posted April 12, 2018 Read through this example. It should answer everything: Link to comment Share on other sites More sharing options...
rzda Posted April 12, 2018 Author Share Posted April 12, 2018 Yes, I've already read this tutorial but look: https://gyazo.com/4b75a8cf1181c64c7b8f4ef07378608a My settings aren't saving. Link to comment Share on other sites More sharing options...
rzda Posted April 13, 2018 Author Share Posted April 13, 2018 someone can help me? ? Link to comment Share on other sites More sharing options...
Nathan Explosion Posted April 13, 2018 Share Posted April 13, 2018 Unless you show the code from the settings, no. Link to comment Share on other sites More sharing options...
rzda Posted April 13, 2018 Author Share Posted April 13, 2018 Ok buddy This is what I have in settings.php in FTP /plugins/name/ $form->add( new \IPS\Helpers\Form\Text( 'shape_icon_aws', \IPS\Settings::i()->shape_icon_aws, FALSE, array( 'app' => 'core', 'key' => 'Admin', 'autoSaveKey' => 'shape_icon_aws' ) ) ); $form->add( new \IPS\Helpers\Form\Text( 'color_icon_aws', \IPS\Settings::i()->color_icon_aws, FALSE, array( 'app' => 'core', 'key' => 'Admin', 'autoSaveKey' => 'color_icon_aws' ) ) ); $form->add( new \IPS\Helpers\Form\Text( 'groups_icon_aws', \IPS\Settings::i()->groups_icon_aws, FALSE, array( 'app' => 'core', 'key' => 'Admin', 'autoSaveKey' => 'groups_icon_aws' ) ) ); And this in /plugins/name/dev/html <ips:template parameters="" /> <i style='color: {setting="color_icon_aws"}' class='fa fa-{setting="shape_icon_aws"}'></i> Also this is what I have in settings of the plugin https://gyazo.com/6efcf47b17cb63d3e75c39e15427291e Link to comment Share on other sites More sharing options...
Nathan Explosion Posted April 13, 2018 Share Posted April 13, 2018 1 hour ago, Sharpyku said: This is what I have in settings.php in FTP /plugins/name/ Nothing else? Show all the code you have in the file. Link to comment Share on other sites More sharing options...
rzda Posted April 13, 2018 Author Share Posted April 13, 2018 4 hours ago, Nathan Explosion said: Nothing else? Show all the code you have in the file. Nothing else. This is in settings.php $form->add( new \IPS\Helpers\Form\Text( 'shape_icon_aws', \IPS\Settings::i()->shape_icon_aws, FALSE, array( 'app' => 'core', 'key' => 'Admin', 'autoSaveKey' => 'shape_icon_aws' ) ) ); $form->add( new \IPS\Helpers\Form\Text( 'color_icon_aws', \IPS\Settings::i()->color_icon_aws, FALSE, array( 'app' => 'core', 'key' => 'Admin', 'autoSaveKey' => 'color_icon_aws' ) ) ); $form->add( new \IPS\Helpers\Form\Text( 'groups_icon_aws', \IPS\Settings::i()->groups_icon_aws, FALSE, array( 'app' => 'core', 'key' => 'Admin', 'autoSaveKey' => 'groups_icon_aws' ) ) ); this is the plugin <ips:template parameters="" /> <i style='color: {setting="color_icon_aws"}' class='fa fa-{setting="shape_icon_aws"}'></i> those are the settings. AS I SAID, THEY ARE NOT SAVING. Like on groups i put 4 and press save, the message "Saved." appears but when i click edit again the 4 is not there. Link to comment Share on other sites More sharing options...
Adriano Faria Posted April 13, 2018 Share Posted April 13, 2018 20 minutes ago, Sharpyku said: Nothing else That's why it isn't saving. You need to have: $form->add( new \IPS\Helpers\Form\Text( 'shape_icon_aws', \IPS\Settings::i()->shape_icon_aws, FALSE, array( 'app' => 'core', 'key' => 'Admin', 'autoSaveKey' => 'shape_icon_aws' ) ) ); $form->add( new \IPS\Helpers\Form\Text( 'color_icon_aws', \IPS\Settings::i()->color_icon_aws, FALSE, array( 'app' => 'core', 'key' => 'Admin', 'autoSaveKey' => 'color_icon_aws' ) ) ); $form->add( new \IPS\Helpers\Form\Text( 'groups_icon_aws', \IPS\Settings::i()->groups_icon_aws, FALSE, array( 'app' => 'core', 'key' => 'Admin', 'autoSaveKey' => 'groups_icon_aws' ) ) ); if ( $values = $form->values() ) { $form->saveAsSettings(); return TRUE; } return $form; Link to comment Share on other sites More sharing options...
Nathan Explosion Posted April 13, 2018 Share Posted April 13, 2018 5 minutes ago, Sharpyku said: AS I SAID, THEY ARE NOT SAVING. I KNOW!!! Where is the saving section of the settings.php? It would explain loads y'see....it's the bit at the end of the settings.rename.php that your plugin has when you create it: //<?php $form->add( new \IPS\Helpers\Form\Text( 'plugin_example_setting', \IPS\Settings::i()->plugin_example_setting ) ); if ( $values = $form->values() ) { $form->saveAsSettings(); return TRUE; } return $form; Link to comment Share on other sites More sharing options...
rzda Posted April 13, 2018 Author Share Posted April 13, 2018 8 minutes ago, Adriano Faria said: That's why it isn't saving. You need to have: $form->add( new \IPS\Helpers\Form\Text( 'shape_icon_aws', \IPS\Settings::i()->shape_icon_aws, FALSE, array( 'app' => 'core', 'key' => 'Admin', 'autoSaveKey' => 'shape_icon_aws' ) ) ); $form->add( new \IPS\Helpers\Form\Text( 'color_icon_aws', \IPS\Settings::i()->color_icon_aws, FALSE, array( 'app' => 'core', 'key' => 'Admin', 'autoSaveKey' => 'color_icon_aws' ) ) ); $form->add( new \IPS\Helpers\Form\Text( 'groups_icon_aws', \IPS\Settings::i()->groups_icon_aws, FALSE, array( 'app' => 'core', 'key' => 'Admin', 'autoSaveKey' => 'groups_icon_aws' ) ) ); if ( $values = $form->values() ) { $form->saveAsSettings(); return TRUE; } Lol thanks man im such a noob. Link to comment Share on other sites More sharing options...
rzda Posted April 13, 2018 Author Share Posted April 13, 2018 @Adriano Faria can i make somehow a color picker? Link to comment Share on other sites More sharing options...
Adriano Faria Posted April 13, 2018 Share Posted April 13, 2018 $form->add( new \IPS\Helpers\Form\Color( 'your_setting', \IPS\Settings::i()->your_setting, FALSE ) ); Link to comment Share on other sites More sharing options...
rzda Posted April 13, 2018 Author Share Posted April 13, 2018 ty man Link to comment Share on other sites More sharing options...
Adriano Faria Posted April 13, 2018 Share Posted April 13, 2018 You can see all fields type on system\Helpers\Form. Link to comment Share on other sites More sharing options...
rzda Posted April 13, 2018 Author Share Posted April 13, 2018 2 minutes ago, Adriano Faria said: You can see all fields type on system\Helpers\Form. how can i make if a checkbox is set to no to dont show the icon Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.