Macrura Posted July 18, 2018 Author Share Posted July 18, 2018 @gmclelland you definitely won't be able to ckeditor images, because there is no Page to store the images under; unless there is some way that you can use a hook, and then use the PHP option for your field defs and then in that file define your hook etc, In terms of Ck editor, i think you'd need to study the inputfield itself and see how the options are supplied to the inputfield, and then just mimic that; So far i have not had the necessity to use ckeditor field, or images for the Settings Factory, and i don't think it will be able to support images unless someone comes up with an idea for how to solve that problem... Link to comment Share on other sites More sharing options...
gmclelland Posted July 18, 2018 Share Posted July 18, 2018 Thanks Macrura. I just tested and it looks like you can do this: // in site-settings.php // note the toolbar line and inlineMode line [ 'name' => 'ckeditor_test', 'label' => 'CK Editor Test', 'type' => 'InputfieldCKEditor', 'width' => '100', 'description' => 'Some Formatted Test', 'collapsed' => 0, 'value' => '', 'toolbar' => "Bold, Italic", 'inlineMode' => 1, ], Doing that will only show the Bold and Italic buttons in the CKeditor toolbar. It will also use inline mode. I'm not sure about the other stuff yet. I found those settings in wire/modules/Inputfield/InputfieldCKEditor/InputfieldCKEditor.module Hope that helps someone. 2 Link to comment Share on other sites More sharing options...
Zeka Posted July 25, 2018 Share Posted July 25, 2018 @Macrura https://github.com/outflux3/SettingsFactory/blob/master/SettingsFactory.module#L69 I don't think that looping through all admin pages is the optimal way to find all settings pages. In that way, on every page load, all admin pages get loaded and it produces a lot of unnecessary PDO queries. For example in one of my project, I have a lot of repeater/matrix pages and I get this stats without/with the SettingFactory module: Pages loaded (38 / 239) PDO queries (38 / 224) 2 Link to comment Share on other sites More sharing options...
Macrura Posted July 25, 2018 Author Share Posted July 25, 2018 right, ok thanks for the report – i have an easy fix for this, will post update soon. 1 Link to comment Share on other sites More sharing options...
Macrura Posted July 25, 2018 Author Share Posted July 25, 2018 @Zeka I think the 2 things that need to happen are (1) change the selector and not have to iterate, that was not efficient, but the process does not appear to be queryable; if the process was able to be part of the selector that would solve this issue completely, but for some reason it doesn't work which is why it ends up being an in-memory find; if we add a field to the module that sets the parent of the settings pages under admin, that would reduce the pages loaded, tested this and it did reduce that by a lot. $adminPages = $this->wire('pages')->find("template=admin,parent=2153"); $settingsPages = $adminPages->find("process=ProcessSettingsFactory"); $adminPages->uncacheAll(); (2) not sure if the uncacheAll() call here is correct, but it also seems to further reduce the pages loaded. If you want to hack the module and see if these changes work in your setup (make sure to change the parent=id to the id of the parent of the settings process pages), I'll carry on testing and researching here; If anyone out there knows why the process is not queryable by the selector engine, that would be good to know, would help on another module also.. Link to comment Share on other sites More sharing options...
Zeka Posted July 25, 2018 Share Posted July 25, 2018 Hi. Test this $module_id = wire('modules')->getModuleInfo('ProcessSettingsFactory')['id']; $adminPages = $this->wire('pages')->find("template=admin, process=$module_id"); 4 Link to comment Share on other sites More sharing options...
adrian Posted July 25, 2018 Share Posted July 25, 2018 Looks good here: 1 Link to comment Share on other sites More sharing options...
Macrura Posted July 25, 2018 Author Share Posted July 25, 2018 ok thanks @Zeka and @adrian, the module has been updated. 2 Link to comment Share on other sites More sharing options...
Peejay Posted August 6, 2018 Share Posted August 6, 2018 Hi, After updating to PW 3.0.109 i get the following error: Error: Call to a member function attr() on null in .../site/assets/cache/FileCompiler/site/modules/SettingsFactory/ProcessSettingsFactory.module on line 137 Can't figure out, what's going wrong :s Link to comment Share on other sites More sharing options...
gmclelland Posted August 6, 2018 Share Posted August 6, 2018 Hi Peejay, What happens when you go to /processwire/module/ and click on the "clear compiled files" button? I just upgraded my local install and I'm not seeing this problem. Link to comment Share on other sites More sharing options...
Peejay Posted August 6, 2018 Share Posted August 6, 2018 Hi gmclelland, Thx for your fast reply ?. I tried your module with only inputfields (like your example kitchen-sink) and then there is no problem. But when I use your "wiretabs" example then I get the error. Link to comment Share on other sites More sharing options...
gmclelland Posted August 6, 2018 Share Posted August 6, 2018 All credit goes to Macrura, it is his module. Can you post the code you are using? Link to comment Share on other sites More sharing options...
Peejay Posted August 6, 2018 Share Posted August 6, 2018 $inputfields = new InputfieldWrapper(); //--------------------------------------------------- $general = [ [ 'name' => 'site_name', 'label' => __('Site Name'), 'type' => 'InputfieldText', 'required' => true, 'value' => '', 'useLanguages' => true ], [ 'name' => 'email_address', 'label' => __('E-mail'), 'type' => 'InputfieldEmail', 'required' => true, 'value' => '', 'columnWidth' => 33 ], [ 'name' => 'telephone', 'label' => __('Telephone'), 'type' => 'InputfieldText', 'required' => true, 'value' => '', 'columnWidth' => 34 ], [ 'name' => 'facebook', 'label' => __('Facebook'), 'type' => 'InputfieldText', 'value' => '', 'columnWidth' => 33 ] ]; $tab = new InputfieldWrapper(); $tab->attr('title', 'General'); $tab->attr('class', 'WireTab'); $tab->add($general); $inputfields->append($tab); return $inputfields; Link to comment Share on other sites More sharing options...
Macrura Posted August 6, 2018 Author Share Posted August 6, 2018 I think you actually need to have more than 1 tab if you're going to use wiretabs (?) you said you tried it with the wiretabs-example.php ? Link to comment Share on other sites More sharing options...
Peejay Posted August 6, 2018 Share Posted August 6, 2018 When I use 1 or more tabs I have the same error. Indeed, I also tried the wiretabs-example.php Link to comment Share on other sites More sharing options...
gmclelland Posted August 6, 2018 Share Posted August 6, 2018 Hmm... It works for me without error. Spoiler <?php /** * since you can only return 1 array to the module, you have to wrap * the tabs in an inputfield wrapper */ $inputfields = new InputfieldWrapper(); //--------------------------------------------------- $general = [ [ 'name' => 'site_name', 'label' => __('Site Name'), 'type' => 'InputfieldText', 'required' => true, 'value' => '' ], [ 'name' => 'email_address', 'label' => __('E-mail'), 'type' => 'InputfieldEmail', 'required' => true, 'value' => '' ], [ 'name' => 'telephone', 'label' => __('Telephone'), 'type' => 'InputfieldText', 'required' => true, 'value' => '' ], [ 'name' => 'fax', 'label' => __('Fax'), 'type' => 'InputfieldText', 'value' => '' ], ]; $tab = new InputfieldWrapper(); $tab->attr('title', 'General'); $tab->attr('class', 'WireTab'); $tab->add($general); $inputfields->append($tab); //--------------------------------------------------- // $location = [ // [ // 'name' => 'address', // 'label' => __('Address'), // 'type' => 'InputfieldText', // 'required' => true, // 'value' => '' // ], // [ // 'name' => 'postal_code', // 'label' => __('Postal code'), // 'type' => 'InputfieldText', // 'required' => true, // 'value' => '', // 'columnWidth' => 33 // ], // [ // 'name' => 'city', // 'label' => __('City'), // 'type' => 'InputfieldText', // 'required' => true, // 'value' => '', // 'columnWidth' => 67 // ], // ]; // $tab = new InputfieldWrapper(); // $tab->attr('title', 'Location'); // $tab->attr('class', 'WireTab'); // $tab->add($location); // $inputfields->append($tab); //--------------------------------------------------- return $inputfields; Did you maybe forget the opening <?php tag? Link to comment Share on other sites More sharing options...
Macrura Posted August 6, 2018 Author Share Posted August 6, 2018 I just upgraded core and the settings do still work; What PHP version are you running? Do you have TracyDebugger installed? Would be good to see what bd($f) is around line 136 Link to comment Share on other sites More sharing options...
Peejay Posted August 6, 2018 Share Posted August 6, 2018 Never mind, It's not an issue in the module. Last weekend I updated my MAMP. ? On my online server the module works! Thanks for your help! ? Link to comment Share on other sites More sharing options...
Peejay Posted August 7, 2018 Share Posted August 7, 2018 There was an issue with "inputfieldButton" in PW 3.0.109. Ryan fixed it yesterday, I pulled the fix en now the issue is resolved. https://github.com/processwire/processwire-issues/issues/653 2 Link to comment Share on other sites More sharing options...
bernhard Posted January 2, 2020 Share Posted January 2, 2020 Hi @Macrura, just tried your module and have some suggestions: This is the screen after installation: What do you think of adding this section in the instructions field? https://github.com/outflux3/SettingsFactory#instructions (or at least the link) You could even add a direct link to create a new page under ADMIN (.../page/add/?parent_id=2) or under SETUP (.../page/add/?parent_id=22). Maybe you also want to add this screenshot for anybody wanting to get a quick impression of how this module looks in action (using the kitchen-sink example file): Looks like I should start using your modules for my projects! ? Thx! How do you handle file uploads? Eg site logo, favicon, image placeholder, invoice template etc? Maybe we get a possibility soon: https://processwire.com/talk/topic/22815-new-post-weekly-update-for-27-dec-2019/?do=findComment&comment=195465 3 Link to comment Share on other sites More sharing options...
adrian Posted January 2, 2020 Share Posted January 2, 2020 5 minutes ago, bernhard said: How do you handle file uploads? Eg site logo, favicon, image placeholder, invoice template etc? @gebeer's awesome https://processwire.com/talk/topic/22665-module-imagereference-pick-images-from-various-sources/ is compatible with Settings Factory. 1 Link to comment Share on other sites More sharing options...
bernhard Posted January 2, 2020 Share Posted January 2, 2020 Thx @adrian true. That would be a good option. Though not ideal imho. But the best option we have so far. Thx Link to comment Share on other sites More sharing options...
gebeer Posted January 2, 2020 Share Posted January 2, 2020 2 hours ago, bernhard said: That would be a good option. Though not ideal imho. But the best option we have so far. Thx I will soon implement the file upload to custom folder feature into ImageReference. Then you can upload an image from within the inputfield to a designated folder and then pick it afterwards. This should make it an even better option for SettingsFactory. 4 Link to comment Share on other sites More sharing options...
bernhard Posted January 2, 2020 Share Posted January 2, 2020 That sounds awesome! Thx for your great work ? Link to comment Share on other sites More sharing options...
Macrura Posted January 2, 2020 Author Share Posted January 2, 2020 @bernhard, many thanks for trying out the module, and for your suggestions and feedback! I will see about implementing the suggestions, especially linking to the Github and Forum topics for anyone who installs it, so that it is easier to grasp how to use it. I'm also hoping to test out the ImageReference field within this and then post example screenshots showing an even more kitchen sink setup, with images etc. Not directly related to your post, but responding more to the general consensus on where and how to create settings pages: I found this module to be most useful in the past couple of years for things like: - Site Schema for a person or business (the fields basically follow the schema.org items; See screenshots below) - Settings for various custom implementations - e.g. api keys, urls, enable/disable features, etc. -- on one site we use this to enable the site manager to choose which comment system to use (Disqus, Facebook etc), and then put in various settings if using Disqus (user id etc) - Theme settings, like you might find on a WordPress theme, stuff like colors, what type of global footer to use, logo selections (using page refs), site title, slogan. It is also a good way to have settings for any custom code you are doing without having to write a module... 3 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