Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/16/2018 in all areas

  1. I use a PageTable field to make edits to children of pages more intuitive… To register the hooks, insert the following Snippet inside your init function in your module (or add it to your init.php file): /** * Initialize the module. * * ProcessWire calls this when the module is loaded. For 'autoload' modules, this will be called * when ProcessWire's API is ready. As a result, this is a good place to attach hooks. */ public function init() { // Prefill pageTable field $this->wire()->addHookBefore('InputfieldPageTable::render', $this, 'addChildrenToPageTableFieldsHook'); $this->wire()->addHookBefore('InputfieldPageTableAjax::checkAjax', $this, 'addChildrenToPageTableFieldsHook'); } Then, add this hook method: /** * Fill pagetable fields with children before editing…. * * @param HookEvent $event */ public function addChildrenToPageTableFieldsHook(HookEvent $event) { $field = $event->object; // on ajax, the first hook has no fieldname if (!$field->name) { return; } // get the edited backend page $editID = $this->wire('input')->get->int('id'); if (!$editID && $this->wire('process') instanceof WirePageEditor) { $editID = $this->wire('process')->getPage()->id; } $page = wire('pages')->get($editID); // disable output formating – without this, the ajax request will not populate the field $page->of(false); // you could also insert a check to only do this with sepcific field names… // $page->set($field->name, $page->children('template=DesiredTemplate')); // just specific templates $page->set($field->name, $page->children); } Now whenever there is a page-table field on your page, it gets populated with the children
    5 points
  2. ProcessNetteTester Run Nette Tester tests within ProcessWire admin. (continued from here) Features AJAX interface for running Nette Tester tests, in bulk or manually display counter, error message and execution time in a table run all tests at once or launch single tests show formatted test error messages and report PHP syntax errors stop on first failed test (optional) hide passed tests (optional) display failed/total instead passed/total (optional) re-run failed tests only (optional) auto scroll (optional) include or exclude tests based on query parameters start/stop all tests with the spacebar reset one test or all tests (ctrl+click) TracyDebugger File Editor integration https://modules.processwire.com/modules/process-nette-tester/ https://github.com/rolandtoth/ProcessNetteTester
    2 points
  3. Maybe just use this module? https://modules.processwire.com/modules/textformatter-video-embed/
    2 points
  4. could you please mark this as [tutorial] or could an admin move it to the tutorials board? thx
    2 points
  5. Thanks for the answers! Tried that and didn't work. Yes, this works. Well, there are all kinds of folks ? If I can enter "title=foo" I expected I could also enter "id=1234"... What I meant with "What pages to show" is Lister eg. this link: /processwire/page/search/ Maybe this should be the default "result" if the search term is empty and you press enter. Now you get "The process returned no content." and that probably isn't very helpful?
    2 points
  6. Hey guys, Thought I would share a quick preview of Designme. A module we (Eduardo @elabx and I) are building for visually laying out your templates/edit screens. ? This is a really quick, zero polish screen grab. FYI. Video #2 - UPDATE This new video shows the following features in Designme: Re-arranging fields via Drag & Drop Re-sizing fields via Dragging. Adjusting field settings - with live refresh. Working on "hidden" fields while Designme is active. Creating New fields. Deleting fields. Creating/Deleting Tabs. Dragging fields between tabs. Creating fieldsets. Tagging/Un-tagging fields. Fields without headers expand when hovered (like checkboxes). Live filtering of fields in the sidebar. Ability to adjust (all) Template settings without leaving Designme. Template File Tree Editing Template files source code with ACE Editor. Editing Multiple files with ACE Editor. (New Tabs) Saving files. Techie stuff Fields load their own js/css dependancies. *ready to use on creation (*most fields) Everything happens via Ajax to ProcessPageEdit (via module + hooks). Designme has a JS api that you can use. All actions trigger events. We would love any detailed feedback on what you see so far. If you are interested in testing Designme. Let me know below. ? Video #1.
    1 point
  7. You cannot delete the pages directly from javascript, you have to make a call to the server. My recommendation from what I can tell from your module, is to turn the list of checkboxes into an actual form: $out = "<form action='.' method='post'>; Remember to close the form tag and also add a button for submit! Check the boxes, click the submit button an there goes the request to the server. You then check on your execute() method for the comment input like: public function ___execute() { if(count($_POST['comment']){ foreach($_POST['comment'] as $comment){ wire('pages')->delete($comment); } } //rest of the code One difference here from what I read on your code, the wire() function which holds all the PW variables you are used to use on templates. After you delete them, the rest of your logic can stay the same, as it will only find the pages that haven't been deleted.
    1 point
  8. I think this is by design to optimize queries. But not sure. It uses COUNT in SQL to evaluate children counts which don't check for page status, I can imagine on very large sets it could get slow? Anyway this case is rare you really need this and have access aware. What is your use case exactly? You can always just loop the pages in question and check for $page->numChildren(true) which is access aware. (You could also store/cache that info in a real field on the page with some hooks and use that.) Some example with numChildren() $res = $pages->find("template=basic-page"); foreach($res as $r){ $r->has_children = $r->numChildren(true) > 1 ? "true" : "false" ; } echo " | has children: " . $res->find("has_children=true"); echo " | no children: " . $res->find("has_children=false");
    1 point
  9. Thanks for all of your help! Handsontable looked very promising (and was easy to set up) . The Filter and search options are what made me question the module, but as from MySQL 5.7 JSON should be searchable that drawback could maybe be bypassed. Matrix was on my list already, but I could not get it to work, as it needs a bit more understanding of processwire concepts for setup. It looks perfect but is clearly not a beginners module. But I really should give it another try...
    1 point
  10. Did CKEditor end up being updated in 3.0.107? I can't find it in the notes.
    1 point
  11. # ----------------------------------------------------------------------------------------------- # 9. If you only want to allow HTTPS, uncomment the RewriteCond and RewriteRule lines below. # ----------------------------------------------------------------------------------------------- # RewriteCond %{HTTPS} off # RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] This part of the .htaccess works absolutely perfect - at least for all my ProcessWire powered sites which are a few now. Too many redirects is most likely a caching problem in your browser. Try it in a private/incognito window again. If this doesn't change the wrong behaviour try a Google search for similar problems with your hosting company. Some hosting companies do weird things sometimes. If you are using any kind of CDN (for example: Cloudflare) disable caching, routing or forcing https and enable debug/developer mode.
    1 point
  12. Ok, @vincent I've submitted a pull request to get this change into the master repository. Thanks for checking.
    1 point
  13. @netcarver your version fixes the conflict in my installation. Thank you !
    1 point
  14. @vincent Yes, sounds like the same problem. If you edit the .module file and make the change I posted above, your problem should be resolved. I cloned the repo and added the change. Can you try my version from here and let me know if that fixes it for you. If so, I'll send a PR over to Adrian.
    1 point
  15. Hello @adrian and @netcarver I think I have the same issue here. When I try to hide the tab "Settings", I can't add a new repeater field item on a page if I'm logged in as a non-superuser. With other choices ("Children", "Restore", etc) there is no conflict.
    1 point
  16. Hi @adrian I'm seeing an error - apparently due to this module - when trying to add a Repeater item on a page where tabs have been hidden and I'm not logged in as a super-user (all ok when logged in as a Super.) Fatal error: Uncaught Error: Call to a member function wrapAttr() on null in /site/modules/RestrictTabView/RestrictTabView.module:117 Stack trace: #0 site/modules/RestrictTabView/RestrictTabView.module(79): RestrictTabView->removeTabs('Settings', Object(ProcessWire\HookEvent)) #1 /wire/core/Wire.php(383): RestrictTabView->afterBuildForm(Object(ProcessWire\HookEvent)) #2 /wire/core/WireHooks.php(825): ProcessWire\Wire->_callMethod('afterBuildForm', Array) #3 /wire/core/Wire.php(442): ProcessWire\WireHooks->runHooks(Object(ProcessWire\ProcessPageEdit), 'buildForm', Array) #4 /wire/modules/Process/ProcessPageEdit/ProcessPageEdit.module(531): ProcessWire\Wire->__call('buildForm', Array) <snip> This causes ajax loaded repeater items to fail. Guarding the call seems to fix it... if ($pn instanceof Inputfield) { $pn->wrapAttr('style', 'display:none;'); }
    1 point
  17. In this demo video, it is working from the existing 'home' template. All Ajax requests are going directly to the existing ProcessPageEdit url. there are no 'dynamic templates', but very shortly, you will have the ability to create templates on the fly from the page tree and start editing directly in Designme to speedup template/data model creation. So you can start with a completely blank template/editscreen and start throwing in fields as fast as possible. (hope this makes sense).
    1 point
  18. You can also use http://modules.processwire.com/modules/module-settings-import-export/. Works great for me.
    1 point
  19. I think they are referring to a Drupal setting that maps to CKEditor's config.fullPage, for editing a full HTML document? That's not something we use. Though it's possible I'm missing something. I noticed CKEditor 4 is now up to version 4.9.2 (we are on 4.8.0). Maybe they have fixed the issue in CKE. I'm going to update to 4.9.2 in PW core 3.0.107 this week, hopefully that'll help.
    1 point
  20. @adrian tyvm if anyone needs example of insert custom field before other form fields: wire()->addHookAfter('ProcessPageEdit::buildForm', function($event) { $pp = wire('pages')->get(wire('input')->get->id); $form = $event->return; $field = wire('modules')->get("InputfieldMarkup"); $field->label = 'TEST'; $field->value = $pp; $field2 = $form->get('title'); // Field to find and insert new field "before" it $form->insertBefore($field,$field2); });
    1 point
  21. @noelboss I used form template processwire way back before Formbuilder was released, and it worked fine; You can also very easily setup a service page to accept the form's post data and process it any way you want. It's very simple to do this; you can also get some ideas for how to build this: https://processwire.com/talk/topic/3779-use-csrf-in-your-own-forms/ https://processwire.com/talk/topic/2089-create-simple-forms-using-api/ https://processwire.com/talk/topic/14206-contact-form-tutorial/
    1 point
×
×
  • Create New...