-
Posts
6,671 -
Joined
-
Last visited
-
Days Won
366
Everything posted by bernhard
-
RockMigrations1 - Easy migrations from dev/staging to live server
bernhard replied to bernhard's topic in Modules/Plugins
Added support for renaming templates (and related fieldgroups): https://github.com/BernhardBaumrock/RockMigrations/commit/fd465dc27e4f2e3982ed6669da0478df8addfd90 $newTemplate = $rm->renameTemplate('oldtemplate', 'newtemplate'); -
Thx that helped! I just deleted the exceptions.txt logfile which had some base64 encoded string in it. I guess this was the culprit ?
-
This has been discussed before. I'm not against it, but I'm also fine with using the module. It works reliably.
-
+1 Your clients might also find this helpful:
-
Think that would be a job for @Gadgetto ?
-
@adrian any idea what could be the cause for this: Error in ProcesswireLogsPanel ProcessWire\WireException: Unable to encode array data for cache: TracyLogData.ProcessWire in C:\www\xxx\wire\core\WireCache.php:450 Stack trace: #0 C:\www\xxx\site\assets\cache\FileCompiler\site\modules\TracyDebugger\panels\ProcesswireLogsPanel.php(44): ProcessWire\WireCache->save('TracyLogData.Pr...', false, '2010-04-08 03:1...') #1 C:\www\xxx\site\assets\cache\FileCompiler\site\modules\TracyDebugger\tracy-2.6.x\src\Tracy\Bar\Bar.php(147): ProcesswireLogsPanel->getTab() #2 C:\www\xxx\site\assets\cache\FileCompiler\site\modules\TracyDebugger\tracy-2.6.x\src\Tracy\Bar\Bar.php(121): Tracy\Bar->renderPanels('') #3 C:\www\xxx\site\assets\cache\FileCompiler\site\modules\TracyDebugger\tracy-2.6.x\src\Tracy\Bar\Bar.php(97): Tracy\Bar->renderHtml('main') #4 C:\www\xxx\site\assets\cache\FileCompiler\site\modules\TracyDebugger\TracyDebugger.module.php(1713): Tracy\Bar->render() #5 C:\www\xxx\wire\core\Wire.php(383): TracyDebugger->sessionHandlerDBAjaxFix(Object(ProcessWire\HookEvent)) #6 C:\www\xxx\wire\core\WireHooks.php(917): ProcessWire\Wire->_callMethod('sessionHandlerD...', Array) #7 C:\www\xxx\wire\core\Wire.php(442): ProcessWire\WireHooks->runHooks(Object(ProcessWire\ProcessWire), 'finished', Array) #8 C:\www\xxx\wire\core\ProcessWire.php(609): ProcessWire\Wire->__call('finished', Array) #9 C:\www\xxx\wire\core\ProcessWire.php(505): ProcessWire\ProcessWire->__call('finished', Array) #10 C:\www\xxx\wire\modules\Process\ProcessPageView.module(258): ProcessWire\ProcessWire->setStatus(16) #11 C:\www\xxx\wire\core\Wire.php(380): ProcessWire\ProcessPageView->___finished() #12 C:\www\xxx\wire\core\WireHooks.php(813): ProcessWire\Wire->_callMethod('___finished', Array) #13 C:\www\xxx\wire\core\Wire.php(442): ProcessWire\WireHooks->runHooks(Object(ProcessWire\ProcessPageView), 'finished', Array) #14 C:\www\xxx\index.php(56): ProcessWire\Wire->__call('finished', Array) #15 {main} Latest version. Error seems to occur only on windows (but not sure).
-
wire()->addHookAfter('Pages::saveReady(template=articolo,in_evidenza=1)', function($event) { $reset = $this->pages->find("in_evidenza=1"); foreach($reset as $p) $p->setAndSave('in_evidenza', 0); });
-
Not sure if there's a better way but this should work: $wire->addHookAfter("Inputfield::render", function($event) { $field = $event->object; $id = (int)str_replace('repeater_item_', '', $field->name); $page = $this->pages->get($id); });
-
https://processwire.com/blog/posts/building-custom-admin-pages-with-process-modules/#using-internal-components-modules
-
See here: https://github.com/BernhardBaumrock/tabulator.test/blob/837d509f1ef6816fe3629c163bd66d53c5e39209/site/ready.php#L31-L73 That's exactly doing what you are looking for but also creates a ZIP of the sql (which reduces size drastically). It also comes with a restore script: https://github.com/BernhardBaumrock/tabulator.test/blob/master/site/assets/mysqldump/restore.php This is the first time I'm using it, so it's not well tested and some parts are hardcoded (eg tabulator.sql / tabulator.zip). But it should get you going. I created this because the pw internal dump takes ages to restore ( for @dragan it took several hours? ). My workflow: logout commit changes push changes
-
Need help troubleshooting this error.
bernhard replied to OrganizedFellow's topic in General Support
VSCode makes working with git a breeze and now that github has unlimited private repos it's really great combination! https://code.visualstudio.com/Docs/editor/versioncontrol https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens -
I think that's the best solution and I can't think of any problems using it ?
-
How to intercept InputfieldButton click event via JS?
bernhard replied to bernhard's topic in General Support
And how would i log that to the console when the panel is closed? I'll file an issue on github for a little change that the events are triggered on the toggling element instead of $(document) - I think that would be the best solution. Thx for your help! Please give the issue a thumb up: https://github.com/processwire/processwire-issues/issues/975 Then triggering the grid reload is as simple as this: $(document).on('pw-panel-closed', '.rt-reload', function() { RockTabulator.getGrid(this).reload(); }); -
How to intercept InputfieldButton click event via JS?
bernhard replied to bernhard's topic in General Support
Yes, if I'm not missing anything: https://github.com/processwire/processwire/blob/master/wire/modules/Jquery/JqueryUI/panel.js#L387 Actually that's my own fault ? ? https://github.com/processwire/processwire/pull/107 -
How to intercept InputfieldButton click event via JS?
bernhard replied to bernhard's topic in General Support
The href attribute is there for a reason: I'm developing RockTabulator and a comman scenario is having a button to add new pages on top of the grid. I want this button to open the page edit screen of the newly created page in a pw-panel. And I want it to support middle-clicks to open the link in a new tab (that's why I need the href attribute and the data-href alone is not enough). So far, so good (and easy). But pw-panel does not offer a way to check which element triggered the opening of the panel. So I wanted to create a workaround that does the following: When a link/button having class "rt-panel" is clicked, open a pw-panel and (and that's what differs from pw-panel) when this panel is closed, reload the corresponding grid. pw-panels have the "pw-panel-closed" event, but I know nothing about the triggering element. So if I had 3 grids with one "add new ..." button each, I'd have to reload all 3 grids even if a page was only added to one grid (and only this grid should get reloaded). That's why I wanted to intercept the click on the link, add the triggering element to the panel element (as data-toggle or whatsoever) and whenever a pw-panel is closed check for the triggering element, get the grid and fire the grid.reload() Hope that makes things clearer. Maybe a request to change the implementation of pw-panels would make more sense. Just wanted to know if I'm missing something totally obvious ? PS: I could use a regular links as well, but I'm creating buttons in the backend (via PHP) and the syntax for InputfieldButton fits best: $button->addClass('foo bar'); $button->icon('plus'); ... Am I missing a good way of creating simple links that look like buttons that way? Not sure about using InputfieldSubmit - I have to think about that... -
How to intercept InputfieldButton click event via JS?
bernhard replied to bernhard's topic in General Support
It might be easier to add a button via this hook to try it yourself: /site/ready.php $this->addHookAfter("InputfieldText::render", function($event) { $field = $event->object; if($field->name != 'title') return; /** @var InputfieldButton $b */ $b = $this->wire->modules('InputfieldButton'); $b->href = 'https://www.processwire.com'; $b->attr('data-href', $b->href); $b->value = 'pw.com'; $script = '<script>'.$this->files->render(__DIR__ . '/button.js', [], [ 'allowedPaths' => [$this->config->paths->site], ]).'</script>'; $event->return .= $b->render().$script; }); /site/button.js alert('loaded'); $(document).on('click', 'a', function() { alert('click'); return false; }); -
How to intercept InputfieldButton click event via JS?
bernhard replied to bernhard's topic in General Support
Sure ? -
Hello everybody, got stuck on a supposed simple thing: I want to intercept a click on a button that is rendered in the backend from InputfieldButton::render(); The button code is wrapped around an anchor tag because I set the HREF attribute: <a class="InputfieldButtonLink" href="..."> <button class="... rt-panel" name="button" value="..." type="button" data-href="..."> <span class="ui-button-text"><i class="fa fa-plus"></i> Add something</span> </button> </a> I can't seem to find a way how I can prevent PW from opening this link ? The reason why I want to do this is that I need to modify the behaviour of the internal panel. $(document).on('click', 'a.InputfieldButtonLink', function(event) { var $el = $(event.target); alert('clicked'); return false; }); It shows the alert but it also reloads the page, which is not what I want! Outside of PW this works fine: https://jsfiddle.net/baumrock/npvzk6t7/1/ Any ideas? Thx!
-
hooks Admin hook, image upload, watermark, PIM
bernhard replied to Hardoman's topic in General Support
You are on the right track. See also here: Are you using tracy debugger? It can help a lot, eg using bd('hook fired'); will show you what's going on in the tracy bar (or using firelogger fl() can also be helpful. -
Pushed a new version yesterday that fixes the issue that .ready and .hooks files might be publicly readable thanks to @jens.martsch and @teppo Please update the module to the latest master version and rename all your .ready and .hooks files to .ready.php and .hooks.php! https://github.com/BernhardBaumrock/RockMarkup2/commit/e9c0bcf43d84078e36ee9e219d19b911c180e168