pmarki Posted August 30, 2016 Share Posted August 30, 2016 (edited) This module provides a solution for keeping various site settings in one place (titles, slogans, api keys, emails, addresses, etc.). Features - Admin can create unlimited number of settings - Settings can be grouped - Admin can set setting label, notes, property name, field width and type - Settings can be of type text, checkbox, radios, select, email, url, integer How to use In module configuration create as many settings as needed. Customize their label, type, width and provide a name you want to use in a template files (property name). After that admin can set those settings on "General Settings" page in "Setup" section. Every time you wish to output eg. site name you can use $settings->site_name or wire('settings')->site_name or $settings->option2 to get value of 'Check it' as seen on the first screenshot. (Checked checkbox returns 1). You can change global name ($settings) to something else in module configuration. To get basic markup with all settings and their values use $settings->render(), usefull to check returning values (esp. select/radios - their values are sanitized as page names). Current limitation:-no way to change order of settings,-new settings can only be added at the bottom. Multilanguage To make fields multilanguage aware create a field with a same property name with '_languageName' appended. Example: Your site has two languages: default and french, create site_title and site_title_french fields. Put in a template $settings->site_title. If a user has set french language, this module output site_title_french, otherwise site_title. Please notice that render() function is not language aware. https://github.com/pmarki/ProcessGeneralSettings Edited September 20, 2016 by pmarki new features added 11 Link to comment Share on other sites More sharing options...
szabesz Posted August 30, 2016 Share Posted August 30, 2016 Interesting idea. Thanks for sharing! Link to comment Share on other sites More sharing options...
tpr Posted August 31, 2016 Share Posted August 31, 2016 I'm using my MultiValueTextformatter module for such things, added to the Home page. Works fine, though it's for the developer only, not for the client because he could easily mess things up. If I use an InputfieldTextaraeaLanguage then it's multilanguage too - btw, is your module multilang capable? I have another idea in mind for such a module that would heavily depend on JavaScript (namely Vue.js). It would be responsible for the UI, all settings would be saved as one JSON. 1 Link to comment Share on other sites More sharing options...
pmarki Posted August 31, 2016 Author Share Posted August 31, 2016 4 hours ago, tpr said: I'm using my MultiValueTextformatter module for such things, added to the Home page. Works fine, though it's for the developer only, not for the client because he could easily mess things up. If I use an InputfieldTextaraeaLanguage then it's multilanguage too - btw, is your module multilang capable? I have another idea in mind for such a module that would heavily depend on JavaScript (namely Vue.js). It would be responsible for the UI, all settings would be saved as one JSON. Yes, I used to use MultiValueTextformatter for this and had the same worries. Just modified it a little to have 'some kind of multilanguage support', not as convenient as built in pw, but better than nothing 1 Link to comment Share on other sites More sharing options...
tpr Posted August 31, 2016 Share Posted August 31, 2016 Multilanguage can complicate things a lot and most non-techie people doesn't even recognize that. At one of my workplaces they asked me to place 3 language flags to the header - they thought it's just as easy like that 2 Link to comment Share on other sites More sharing options...
pmarki Posted September 20, 2016 Author Share Posted September 20, 2016 I have reorganize module settings, it uses JSON and ASM Select for fields, now it's possible to reorder settings, add, delete and so on. The only drawback is that it's not compatible with previous version. If you want to update, you will lose all entered settings. 1 Link to comment Share on other sites More sharing options...
tpr Posted September 20, 2016 Share Posted September 20, 2016 Nice! I haven't used it yet just had a quick look. How about removing the "pencil" icon from the asm items and open the edit modal on click? I think this is the "natural" way of setting asmList item options in PW so people should be aware of that. Link to comment Share on other sites More sharing options...
szabesz Posted September 20, 2016 Share Posted September 20, 2016 27 minutes ago, tpr said: asmList item options Where are those options? Have I missed them so far? The only similar behavior is the action of the "drop down headers" of Repeater items (but those have the arrow like "greater-than sign") like this: We can only drag-and-drop or delete standard asmSelect list items, at least that's what I have thought so far. Am I missing something? Link to comment Share on other sites More sharing options...
tpr Posted September 20, 2016 Share Posted September 20, 2016 Eg when editing a template you can click on a field (asmList item) and set a few things there (overrides). Is that new to you? Link to comment Share on other sites More sharing options...
szabesz Posted September 20, 2016 Share Posted September 20, 2016 Luckily, I have not had to update templates recently Jokes aside, yeah, now I see what you meant, but as a side note let me add that even those asmSelects have "text with links on them" and I thought you were referring to simply clicking on the bounding box itself and not on an additional element of it like the <a> in this case. The pencil icon might not be used in the ProcessWire admin in this context, but some sort of indicator is used, and generally I like these indicators, so that even newcomers can figure out the intended behavior. Link to comment Share on other sites More sharing options...
tpr Posted September 20, 2016 Share Posted September 20, 2016 Well if they get used to the pencil icon then when wil they learn the default PW workings? There's an issue in the module: its SettingsJS.js is added not only in the module's page but every (admin) page and asmList items get the "pencil" icons. Of course clicking on them do nothing, apart from this error: SettingsJS.js:50 Uncaught TypeError: Cannot read property 'undefined' of null Setting line 42 to this fixes it: if ($this->wire('user')->isLoggedin() && $this->input->get('name') == __CLASS__) { 3 Link to comment Share on other sites More sharing options...
pmarki Posted September 20, 2016 Author Share Posted September 20, 2016 2 hours ago, tpr said: How about removing the "pencil" icon from the asm items and open the edit modal on click? I think I'll leave it as is. It's a good indicator for newcomers and obvious for advanced. 38 minutes ago, tpr said: Setting line 42 to this fixes it: Thanks, fixed Link to comment Share on other sites More sharing options...
tpr Posted September 21, 2016 Share Posted September 21, 2016 Have you updated the module in the module directory? Update says the latest is v110. Link to comment Share on other sites More sharing options...
pmarki Posted September 21, 2016 Author Share Posted September 21, 2016 Oh, Forgot to change version number, but already fixed. Thanks @tpr Link to comment Share on other sites More sharing options...
tpr Posted September 21, 2016 Share Posted September 21, 2016 You should also visit the module page and edit it to force updating it in the directory (you don't have to edit anything, just enter email/pw and Save): http://modules.processwire.com/edit/process-general-settings Link to comment Share on other sites More sharing options...
pmarki Posted September 21, 2016 Author Share Posted September 21, 2016 Done, but honestly I thought it's done automatically. Link to comment Share on other sites More sharing options...
kongondo Posted September 21, 2016 Share Posted September 21, 2016 20 minutes ago, pmarki said: Done, but honestly I thought it's done automatically. It is done automatically, once a day I think (?)...However, you can always do it manually if you can't wait Link to comment Share on other sites More sharing options...
monchu Posted October 1, 2016 Share Posted October 1, 2016 Hi pmarki, can I use this module for pw 3.xx version? Link to comment Share on other sites More sharing options...
pmarki Posted October 1, 2016 Author Share Posted October 1, 2016 9 hours ago, monchu said: Hi pmarki, can I use this module for pw 3.xx version? Yes, it works with pw3. Just updated module info and added textarea field. 2 Link to comment Share on other sites More sharing options...
titanium Posted October 13, 2016 Share Posted October 13, 2016 Great module, pmarki Any chance to provide a file/image field for storing site-wide logos etc.? Link to comment Share on other sites More sharing options...
pmarki Posted October 13, 2016 Author Share Posted October 13, 2016 If only I knew how to do this... Adding file fields isn't easy, beacuse you have to store a file somewhere. So far I haven't find a way to achieve this But any advice would be appreciated Link to comment Share on other sites More sharing options...
titanium Posted October 13, 2016 Share Posted October 13, 2016 I'm sorry, but I'm facing exactly the same problem. I'm no expert at all, but I guess the module has to create a new file/image field, a new template with that field assigned and finally a new page based on that template. Then this page could be used to store the image. Somehow. Maybe. Link to comment Share on other sites More sharing options...
Macrura Posted October 13, 2016 Share Posted October 13, 2016 i would think that a general site settings module should just store settings, and not any files or images - if you need those just add a custom field to your settings template (?) alternately ftp upload the image to a specific folder and then reference that file's path in the setting... 1 Link to comment Share on other sites More sharing options...
titanium Posted October 14, 2016 Share Posted October 14, 2016 14 hours ago, Macrura said: alternately ftp upload the image to a specific folder and then reference that file's path in the setting... There's certainly nothing wrong with that approach and for sure it's quite common, but I think it is somewhat limited: the customer/editor has to leave his known environment (ProcessWire backend in this case) and has to use FTP/SSH whatever the referenced image is not available for image manipulations, for example: automatic creation a favicons in different solutions Link to comment Share on other sites More sharing options...
Macrura Posted October 14, 2016 Share Posted October 14, 2016 it depends - a lot of times if you are talking about a logo, that is a really specific image that might be precisely sized and optimized for display, may have light/dark versions, smaller icon version for mobile, maybe a version with a tagline, as well as possibly retina versions; it could be something you don't want the client to have access to change. On the other hand if you did want the client to have access to it and be able to change it, you might need a multi-image field with tags, so that you could upload all of the versions of the logo and tag them (light, dark, retina, icon or whatever). This is why i would recommend using the system's native image fields for images... 1 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