Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted April 12, 20187 yr 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.
April 12, 20187 yr Author Yes, I've already read this tutorial but look: https://gyazo.com/4b75a8cf1181c64c7b8f4ef07378608a My settings aren't saving.
April 13, 20187 yr Author 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
April 13, 20187 yr 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.
April 13, 20187 yr Author 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.
April 13, 20187 yr Community Expert 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;
April 13, 20187 yr 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;
April 13, 20187 yr Author 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.
April 13, 20187 yr Community Expert $form->add( new \IPS\Helpers\Form\Color( 'your_setting', \IPS\Settings::i()->your_setting, FALSE ) );
April 13, 20187 yr Author 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
Archived
This topic is now archived and is closed to further replies.