Jump to content

Macrura

PW-Moderators
  • Posts

    2,776
  • Joined

  • Last visited

  • Days Won

    40

Everything posted by Macrura

  1. it works well, are you seeing css problems?
  2. The process of setting up a settings page is very simple; You need to start with a JSON or PHP fields definition file; There are samples of these in the module. Once you have your file in valid JSON, or PHP that returns an array of inputfields, you would create a page somewhere under your Admin branch. You can name this whatever you want, but bear in mind that the name of the process page is how you will access your settings. Once you create the page (using Admin template), and set the process as "ProcessSettingsFactory", you should see a blank text field; In this field you enter the path to your definition file, which should be located somewhere in templates. At this point you can now access your settings page and see if it works (you should see your fields). You can populate the fields, and save, and your data will save in the module config. You can now access your settings on the front end by doing this: $factory = $modules->get("SettingsFactory"); $newsSettings = $factory->getSettings('news-settings');// where news-settings is the name of the process page holding the settings you want to get, You can view the contents of what is returned Tracy (e.g. bd($newsSettings);) So far this has been rock solid on some very big sites, both in terms of users accessing and modifying settings, as well as dealing with permissions to the settings, and outputting the settings in the front end; Haven't noticed any performance issues, and some sites have 5-6 different settings panels.
  3. @LAPS form-builder.inc: /** * * Add custom scripts to the form. * */ $forms->addHookBefore('FormBuilder::render', function($event) { $form = $event->arguments(0); $config = wire('config'); switch ($form->name) { case 'name-of-form': $config->scripts->add($config->urls->templates . "libraries/chosen/name-of-js.js"); $config->styles->add($config->urls->templates . "libraries/chosen/name-of-css.css"); $config->scripts->add($config->urls->templates . "FormBuilder/custom-js-init-file.js"); break; // other forms can be added below... } }); in your init file: $("#Inputfield_name_of_input").chosen({ no_results_text: "The planet exists not", allow_single_deselect: true, width: '100%' });
  4. the Soundmanager2 module works well for me, using it on like 8 sites now, no problems so far.. Allows api use (e.g. code output in template) or shortcode, like in an RTE, insert an audio player; Rock solid, HTML5, read id 3, skins... really a dream module for audio in PW.
  5. You'd really need to be checking to see if there is an image, here in your code it takes the assumption there is always an image; but instead you'd want to check if there is an image prior to running size on it; that would solve your issue. $image = ''; if(count($page->images)) $image = $page->images->first(); $thumb = ''; $dims = ''; if($image !='') { $thumb = $image->size(100,100)->url; $dims = $image->width . 'x' . $image->height; } $data = array( 'title' => $page->title, 'thumb' => $thumb, 'img_dims' => $dims, 'edit_src' => $page->editUrl ); '<div class="item" style="width:100%;">' + (item.thumb ? '<div class="image-wrapper" style="float:left;"><img src="' + escape(item.thumb) + '" alt=""></div>' : '') + '<div class="info-wrapper" style="float:left; padding:5px;">' + '<span style="font-size:14px;font-weight:bold">' + escape(item.title) + '</span><br>' + '<span>Type: ' + escape(item.type) + '</span><br>' + (item.img_dims ? '<span>Dims: ' + escape(item.img_dims) + 'px</span><br>' : '') + '<a class="pw-modal pw-modal-medium" href="' + escape(item.edit_src) + '">Edit <span class="ui-icon ui-icon-extlink"></span></a></div>' + '</div>'
  6. ok yeah, I'll see if i can improve the readme and i'll post a walkthrough here with some screenshots shortly... In the meantime a lot of the info in this post is still relevant:
  7. you should be able to set the file that the template uses at runtime, so wherever you render the page: $page->template->filename = '/path/to/file.php'; or $t = $templates->get('some-template'); $t->filename = '/path/to/file.php'; quoted from here:
  8. depends on if you are appending a _main.php file; you can also disable that behavior on the template settings; or do it using variables in your templates; As far as I'm aware, generally return $this->halt() is now recommended over exit() but may not work in 100% of scenarios so exit can be used as a contingency...
  9. I don't think I fully understand the setup; does your module create a template that it uses - you could just create the template file in your /templates/ directory and then wireRenderFile() the file in the modules from that; but i'm really not clear on the setup so hard to answer coherently.
  10. wireRenderFile() ?
  11. you can either use the template class or just wireRenderFile() which uses template class – see dashboard module for an example...
  12. yes, since you create the inputfields, they support all built in attributes, so you'd just need to set those attributes in your PHP or JSON array. Yes, each settings page is full access controllable.
  13. what PW version, did you try force reloading to get the CSS to update?
  14. Not sure, i doubt it, but i use Colorsnapper on Mac which lets me pick colors from anywhere on the screen and then i paste the value into the colorpicker field hex
  15. have you tried logging the POST request to both the URL and the URL with the Segment - it should be the same unless somehow URL segments are not activated on that template. The idea should work, I can't think of any reason why segments would not work on an ajax service page; if you keep hitting up against issues you could go for query parameters instead. You may also need to check if there is a URL segment present, like if(strlen($input-urlSegment etc.. ; and make sure to also do the regular sanitization of the $input, as well as return 404 for unused segments...
  16. InputfieldSelectizeMultiple or ajax version – the ajax version was designed for this purpose you describe; non-ajax version has only been tested to work on maybe 500-600 select items
  17. whatever version i'm using works great and has the option to use files and not pasted code, in the field config.. i thought it was the dev branch.. very stable and i have it running on 5 projects now, basically this is a completely indispensable module, i usually end up with on average 10-15 RM fields on any given project..
  18. it always works for me – did you add a general-settings permission and then add that permission to the role you want to have access to the settings? I will also check this on my last install to double check, but yes, it is supposed to work, that's why the module was re-written as a split module with the process.
  19. yep, built a new customac so up and running ( submitted 2 modules today)... this is a tricky one though (lot of fields to make a useful working dashboard)...
  20. neither, content is in database
  21. @chcs have you seen this post?
  22. or maybe we should leave the modules directory as is, and then make the Process module install the other module? I guess that would solve this – so i just need to move the "installs" configuration setting from the non-process to the process...
  23. This has been tested and here are the results: (1) You cannot install this module from the modules directory – the directory needs to be updated to use the primary module class name, which is GeneralSettings, that would presumably fix the issue, because it would download the whole package, and then install the accompanying Process module, after installing the primary non-process module. (2) there was an error in the main module, in that it was set to autoload false; it needs to autoload in order for the init() function to load on the module config screen, and consequently load the required JS and CSS. (3) There was a return statement executing if there was no saved module config data; this would cause the module to appear to not work, as the required JS would never load (it would have worked if you saved the module once). The asset loading was moved above the possibility of return statement executing so the JS will always load. (4) The only tested admin theme that appears to work is Reno; else things look off... will have to be fixed and tested on the other 2 admin themes. Since I do not have access to edit the module, i edited my repo and then I submitted a pull request to @flydev Once he accepts the changes and the modules repository updates, the module should be in a working state. Note that the reason you want to have a separate process module for your settings is so that you can allow access to the settings screen to non-Superusers. The old module version is going to be a problem for a lot of setups where you expect to provide settings to your other admins.
×
×
  • Create New...