-
Posts
6,671 -
Joined
-
Last visited
-
Days Won
366
Everything posted by bernhard
-
Hi @LuisM thx for sharing, that looks great ? I guess you know https://processwire.com/store/pro-dev-tools/profiler-pro/ ? Could you please explain a little how your module works? Does it hook into several methods before and after and tracks timings and memory usage?
- 4 replies
-
- admin area
- monitoring
-
(and 2 more)
Tagged with:
-
The title might sound more exciting that it actually is. It's just a little helper module to keep things organized ? Basically it just saves you from finding the correct require_once("where/is/my/nette?") and, for a little extra security, it adds an .htaccess file to block all direct access to Nette source files. Why? Nette is an awesome framework with some awesome features/utilities that ProcessWire lacks. Creating separate modules and including Nette packages multiple times in those modules would not be efficient. RockNette makes it easy to store them in a central place. Usage You'll get all necessary instructions on the module information screen: https://github.com/BernhardBaumrock/RockNette
-
- 246 replies
-
- 3
-
-
-
- visual studio code
- vsc
-
(and 2 more)
Tagged with:
-
Just created my first VSCode Extension - if you like it please give it a star on Github and rate it on VSCode Marketplace ? Installation: Either via https://marketplace.visualstudio.com/items?itemName=baumrock.pwsnippets or directly in VSCode: Contributions welcome! https://github.com/BernhardBaumrock/pwsnippets
- 13 replies
-
- 21
-
-
-
Thx @porl I've tested the fork locally without any issues, so I just pushed the update and bumped version to 0.0.2 ? https://github.com/BernhardBaumrock/RockLESS/commit/c1738567b1d72aedd175d07a77fefb13d69ca99f
-
I didn't know about VS Code Live Server either ? Look here: https://youtu.be/cj29XdGzNt8?t=269 How does VSCode live server work with different hosts? From the docs i see that it has a proxy feature, but it looks like I'd always have to update the settings when switching project?! ?
-
Exactly what I thought! I also find it counter intuitive that it does not return a boolean value! Your linked example looks good as-is, but it somehow does not feel right to have a ->has() return something else than yes/no. $pages->getID() is great to have and absolutely clear imho ? Ok, I've done some research and I see that we have several HAS... methods returning integers, for example: $page->hasChildren() $page->hasLinks $page->hasReferences Still not sure if it wouldn't be better to have those additionally for clearness: $page->numChildrenVisible() $page->numLinks $page->numReferences Of course that's nothing extremely important, but PW is known for it's awesome API, so it might be good to keep it as clean as possible. What do others think about those wordings?
-
Show data in locked custom field – 'Locked' field not showing
bernhard replied to jonatan's topic in General Support
That's somthing you'll understand once you understand how the PW admin works. What is an Inputfield? What is a Fieldtype? What is a module, what a ProcessModule etc. ? PW has everything abstracted so that it is simple for the general user, but it is on the other hand still very powerful for advanced use. My tutorial about backend pages might be a good read ?- 8 replies
-
- 1
-
-
- locked field
- collapsenolocked
-
(and 3 more)
Tagged with:
-
I'm not sure if I understand your message correctly... Was that a "Thank you for sharing! We have been using it for years and it works great. If someone doesn't know it yet, give it a try!" ?
-
Testing Blisk browser, only 1 feature interests me, live reloading
bernhard replied to OrganizedFellow's topic in Dev Talk
I discovered BrowserSync today and it supports live reloading across multiple browsers (even on mobile via local network)! -
Stumbled over this one today and I'm really impressed! ? https://www.browsersync.io/ It is free! 3 commands setup (really that easy!) Live reloading Proxy to local network (great for testing site on mobile!) @adrian just a FYI as you implemented the viewports panel in tracy and might be interested in this one ?
-
Edit I create a separate topic for this tool - you might be interested ?
-
I think @LAPS wants some place that does NOT load on every request. But all of your mentioned options do load on every request ? How large is that list of E-Mails? ? If that is really too much for every request you can put it In some file that you only include() when you need it In a non-autoload module, that you request when needed (eg $modules->get('myemails')->getAll()) In a WireCache object that is stored in the Database In a dedicated page + field (eg $pages->get(1234)->emailslist)
-
Show data in locked custom field – 'Locked' field not showing
bernhard replied to jonatan's topic in General Support
Hi @jonatan and welcome to the forum ? EDIT: Just saw that you are using the Mystique field. So you could have done just that (untested): $insta = ...; // your logic return [ ... 'fields' => [ 'insta' => [ 'label' => 'Instagram User', 'type' => 'markup', 'value' => $insta, ], ...- 8 replies
-
- 1
-
-
- locked field
- collapsenolocked
-
(and 3 more)
Tagged with:
-
Not sure if that helps, but I have this site under git, so I reverted to 1.0.152, did a modules refresh, then went back to master branch (1.0.153) and this is what I get:
-
It's getting even more confusing - now it works even in /site/ready.php ? <?php namespace ProcessWire; class RockHook extends WireData implements Module { public static function getModuleInfo() { return [ 'title' => 'RockHook', 'version' => '0.0.1', 'summary' => 'RockHook', 'autoload' => true, 'singular' => true, 'icon' => 'bolt', 'requires' => [], 'installs' => [], ]; } public function init() { bd('init()'); bd(1); bd(2); bd(3); bd('add handleWebhook'); $this->addHookAfter("ProcessPageView::execute", $this, "handleWebhook"); bd('add hello-hook in init()'); $this->addHookAfter('hello', function(HookEvent $event) { bd('hello-hook fired in init()'); }); } public function ready() { bd('ready()'); bd('add hello-hook in ready()'); $this->addHookAfter('hello', function(HookEvent $event) { bd('hello-hook fired in ready()'); }); } public function handleWebhook($event) { bd('handlewebhook fired'); bd('trigger $this->hello()'); $this->hello("trigger hello() in execute() hook"); } public function ___hello($where) { bd('hello!', $where); } }
-
-- Update -- The hooks in my module work! Some things to pay attention to: Tracy's bd() call will maybe not be the best option for debugging, because you might have some session redirects going an and that might wipe your dump. So it could be possible that the hook is actually triggered but you will just not see the result. First, I tried using $this->log('...') and saw some more output than using bd(), but the best option (another new learning using TracyDebugger) is this: Using the log() funktion of Tracy is great: This is my setup: // in site/init.php $this->addHookBefore("RockCI::restoreRemote", function($event) { l('restore hooked in site/init.php'); }); // in site/ready.php $this->addHookBefore("RockCI::restoreRemote", function($event) { l('restore hooked in site/ready.php'); }); // in RockCI module $this->addHookBefore("restoreRemote", function($event) { l('restore hooked in RockCI module'); }); So everything here works as expected. Note that the hook in site/ready.php does never get triggered! I'm not 100% sure WHY, and that's why I wish something like this would exist: https://processwire.com/talk/topic/10857-making-hooks-visible-hookrecorder/ Also note that I'm using addHookBefore as the $session->redirect() might prevent any execution of hooks added after that method! Does that help you?
-
That's strange. I've just realized that I did exactly the same in one of my modules and prepared methods to be hookable (just in case I'd need it one day) and those hooks do also not get triggered. The strange thing is that this little module works just as expected: <?php namespace ProcessWire; class RockHook extends WireData implements Module { public static function getModuleInfo() { return [ 'title' => 'RockHook', 'version' => '0.0.1', 'summary' => 'RockHook', 'autoload' => true, 'icon' => 'bolt', 'requires' => [], 'installs' => [], ]; } public function init() { $this->addHookAfter("ProcessPageView::execute", function(HookEvent $event) { $this->hello("trigger hello() in execute() hook"); }); $this->addHookAfter('hello', function(HookEvent $event) { bd('hello hooked in RockHook::init()'); }); } public function ___hello($where) { bd('hello!', $where); } } // in site/ready.php $this->addHookAfter('RockHook::hello', function(HookEvent $event) { bd('hello hooked in /site/ready.php'); }); Edit: Attaching the hook like this does also work: <?php namespace ProcessWire; class RockHook extends WireData implements Module { public static function getModuleInfo() { return [ 'title' => 'RockHook', 'version' => '0.0.1', 'summary' => 'RockHook', 'autoload' => true, 'singular' => false, 'icon' => 'bolt', 'requires' => [], 'installs' => [], ]; } public function init() { $this->addHookAfter("ProcessPageView::execute", $this, "handleWebhook"); $this->addHookAfter('hello', function(HookEvent $event) { bd('hello hooked in RockHook::init()'); }); } public function handleWebhook($event) { $this->hello("trigger hello() in execute() hook"); } public function ___hello($where) { bd('hello!', $where); } }
-
A little promotion... Just stumbled over this one: https://metatags.io/ - it looks nice. Any experience with this or similar tools?
-
What labels are you talking about? (Maybe better in a new thread...)
-
Ok, interesting. I had the same problem today. It's important that loading VEX happens in ready() not in init() of the module ?
-
I'd first confirm that this is really the problem by putting together a test-setup that makes the issue reproducable. It is definitely possible to add hooks inside hooks, but timing is very important! https://processwire.com/blog/posts/new-ajax-driven-inputs-conditional-hooks-template-family-settings-and-more/#new-conditional-hooks So I think it's more likely a problem in your code than a bug in PW...
-
This one is a little bit special... I want to set an Inputfield setting at runtime via code. This works great for changing Inputfield labels or description and having everything under GIT. I'm using ProcessPageEdit::buildForm to modify the Inputfield before it gets rendered. The problem is that this technique does not work in several situations when AJAX is involved. For example I can not set InputfieldFile settings like max filesize or another example is the noLang = 1 setting that hides the multilanguage field descriptions of the Inputfield and shows only one inputfield. When using the buildForm hook, both settings modifications have no effect on newly uploaded files. That means the max filesize will never get checked and the setting noLang = 1 does also only work for existing files. When I upload a file it shows both language inputfields for the description and shows one just after saving the page (because then the buildForm hook knows about the file where to set noLang = 1). Any ideas where I could hook into to modify the settings stored in the database as early as possible? Do you understand my problem / question? ?