Jump to content

bernhard

Members
  • Posts

    3,964
  • Joined

  • Last visited

  • Days Won

    131

Everything posted by bernhard

  1. Hi @tires Of course you can do that! See this example: Place this in site/ready.php (with a current dev version of PW supporting url hooks - otherwise you need to create a custom endpoint for generating the pdf. Or you could use url segments and an if-statement as well): $wire->addHook("/pdf", function($event) { $pdf = $event->modules->get('RockPdf'); $pdf->write('Hello World'); $pdf->download("download-button.pdf"); }); Then add a button to your HTML template file: <a href="/pdf">Your button/link label</a> The content and rendering of the PDF is totally up to you.
  2. Do you mean this? https://processwire.com/api/ref/page/edit-url/
  3. Remove all your hooks, start with mine, add your code pieces step by step and after each step save and check the title. Then you'll quickly find the culprit πŸ™‚
  4. I thought maybe someone here is able and willing to help with this issue? πŸ™‚ https://github.com/processwire/processwire-issues/issues/1309
  5. That's the latest master πŸ˜‰ Latest dev is 3.0.182+ https://github.com/processwire/processwire/commits/dev
  6. No idea why this should be the case. Maybe you have some other hooks firing and making conflicts?
  7. <?php // site/ready.php $wire->addHookAfter("Pages::saveReady", function($event) { $page = $event->arguments(0); $page->title = date("Y-m-d H:i:s"); }); Start with that hook, save the page and see the page title being updated. Then add conditions step by step (eg checking for template) and always check if the page title still updates when saving the page πŸ™‚
  8. You can find plenty of great free resources on the web to learn PHP but I think @wbmnfktr is right that some kind of upfront investment (either time and/or money) in learning the basics of PHP will help you a lot for working with ProcessWire πŸ˜‰ 15 min: https://www.youtube.com/watch?v=ZdP0KM49IVk 5 hours: https://www.youtube.com/watch?v=OK_JCtrrv-c
  9. Or you use the new InputfieldTextTags: https://processwire.com/blog/posts/pw-3.0.177/ πŸ˜‰
  10. Update: Here's a little snippet how to use dynamic navigation items using the NavJSON feature: // in getModuleInfo() 'useNavJSON' => true, // enable JSON nav feature 'nav' => [ [ 'url' => 'contacts', 'label' => 'Contacts', 'icon' => 'users', ],[ 'url' => 'mailings', 'label' => 'Mailings', 'icon' => 'folder-open-o', 'navJSON' => 'mailings-nav', // this will call executeMailingsNav() to get items ],[ 'url' => 'groups', 'label' => 'Groups', 'icon' => 'users', ], ] // and in the module /** * JSON nav for mailings */ public function executeMailingsNav() { $options['add'] = null; // no link to add pages $options['edit'] = $this->mailer()->url."new/?channel={name}"; $options['itemLabel'] = 'label'; // use the label property as item label (default is name) $options['items'] = []; foreach($this->mailer()->channels as $channel) { $data = $this->wire(new WireData()); /** @var WireData $data */ $data->name = $channel->short; $data->label = "New ".$channel->name; $data->icon = "plus-circle"; $options['items'][] = $data; } return parent::___executeNavJSON($options); }
  11. Hey @adrian thx that is the same that @Robin S proposed just without using AOS πŸ˜‰
  12. Hey @horst is this module still necessary? I think there have been some improvements to $pages->sort() some time ago so that this solution by @Robin S might be better than your module? Or am I missing something?
  13. Yes, it does. You didn't say anything about manual sorting πŸ˜‰ See here and for some background here:
  14. Hey @Robin S this looks interesting! Could you please add an example of the output of such a field? What data is the field's value? An array of url strings? Can we use the PageImage sizing functions? What is the use case you developed this for? Thx πŸ™‚ PS: Ok read in the other thread that it seems to return Pagefile/Pageimage object(s). Follow up question: How do you handle deletion of referenced images on the storage page?
  15. You can define the sort settings for children in the parent's settings family tab. There you can select "created" and "reverse sort order"
  16. Another handy update on v1.0.19 πŸ™‚ map(column, labels) Sometimes the value stored in the DB is a key that is not as descriptive as a text label. For example it could be that the returned value of a "sex" column is f for female or m for male. One option is to replace this value via JS which could have benefits regarding performance on large datasets, but it is a little more work to make everything work as expected (eg you need to take care of formatting of the cell as well as the sort and filter values). It might be easier to map the returned value of the finder to an array of labels in such cases: $sexes = ['f'=>'Female', 'm'=>'Male']; $rockfinder->find(...) ->addColumns(["sex", ...]) ->map("sex", $sexes); The column will then show male and female instead of m and f.
  17. Even if that's unlikely but if you are using RockMigrations that's as simple as setting a config variable: $config->filesOnDemand = "https://www.example.com"; https://github.com/BernhardBaumrock/RockMigrations/blob/02bc1b348b3e854d9a46b4cd79929f40233a2732/RockMigrations.module.php#L413-L453
  18. dont think so πŸ˜‰ Usually I do that via hooking ProcessPageEdit::buildForm and the wrapFields method of RM <?php $this->addHookAfter("ProcessPageEdit::buildForm", function(HookEvent $event) { $page = $event->process->getPage(); if($page->template != "yourtemplate") return; $form = $event->arguments(0); $rm = $event->modules->get("RockMigrations"); $rm->wrapFields($form, ['field1', 'field2'], [ 'label' => 'your fieldset label', 'icon' => 'bolt', ]); });
  19. Yes, and I think you don't even need this module for that... simply send a HTTP request to their API: https://github.com/sms77io/ProcessWire/blob/30ac489026bb0f1a5dfdb181b45baef2a5ad5399/Sms77.module#L253-L260 The module seems a little like a marketing thing to me πŸ™‚
  20. Ok I understand now... But there's nothing we can do here. The admin theme/style is the base for backend styling and modules usually inject their scripts lateron. If you have problems with AOS style rules you'll likely be better off trying to request changes there.
  21. I think you should be able to define custom files via $config->AdminThemeUikit = [ 'style' => '', 'recompile' => false, 'compress' => true, 'customCssFile' => '/site/assets/admin.css', 'customLessFiles' => [ '/site/templates/admin.less' ], ]; see https://processwire.com/blog/posts/pw-3.0.179/ That means you should be able to do something like this: $config->AdminThemeUikit = [ 'customLessFiles' => [ '/site/templates/admin.less', '/your/custom/style.less' ], ]; Does that work for you?
  22. What are you trying to achieve? What is the situation? What is the goal?
  23. Do you know why/how the redirect happens? I'd try copying all files as they are on the server, copy the DB and then see if you get it running that way on your dev machine. Once you have it running do the upgrade of PW (which will replace the wire folder) and inspect all the files in site folder carefully. Good luck!
  24. I've never used symfony (only the CLI component) so I have to admit that I don't understand what you are doing here, sorry πŸ˜‰
  25. OK I understand πŸ™‚ Maybe you could cache the result of a findRaw() ? That should be a plain php array that you can use for foreach and dynamic "active" class? πŸ™‚ But still not sure if what you found is an issue or just a limitation... maybe ryan tells us something about it.
Γ—
Γ—
  • Create New...