Pete Posted May 18, 2013 Share Posted May 18, 2013 Hi folks I was just wondering what the best way to handle multiple key/value pairs in a module config would be? For example, in a few modules I will likely need to enter information in a text field and then select an associated page, but up to as many times as the administrator requires. The simplest way would be to use a textarea and go the CSV route and type the page paths manually, so: option1,/path/to/page/ option2,/path/to/another/page/ Whilst this way of doing things is fine, I wonder if there's another way (doesn't matter that it essentially gets saved as a CSV behind the scenes - it would just be nice to make the config simpler to use and remove the chance of typos in paths I'm going to have a crack at it with some jQuery as I've just had an idea, but if anyone has any other suggestions I'm all ears Link to comment Share on other sites More sharing options...
ryan Posted May 19, 2013 Share Posted May 19, 2013 Pete, you can store arrays in a module config: $data = array( 'options' => array( '/path/to/page/', '/path/to/another/page/' ) ); $modules->saveModuleConfigData('MyModuleName', $data); Of course 'options' could be an associative array too if you wanted it. Link to comment Share on other sites More sharing options...
Pete Posted May 19, 2013 Author Share Posted May 19, 2013 Thanks - that will help me when I've got my jQuery goodness sorted that adds new rows of fields. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now