Jump to content

iank

Members
  • Posts

    101
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by iank

  1. @ryan - thanks for the quick response! That worked perfectly. 👍 I'll mark this as solved. Much appreciated, Ian. P.S. For anyone interested, here's the site and the specific page that the client noticed had the issue - content in 4 languages (English, French, German, Dutch) all now rendering as expected: https://www.traffic.org/unite-fr/
  2. Hi, I have a site that uses Multi-language URLs and Multi-language Page names to present different language content for the same page, using a language specific URL. After upgrading PW to version 3.0.229, the language-specific field data is only displayed if the home page has the language name (segment) specified and marked as active. Prior to this ( version 3.0.165, I'm not sure at which version this changed), it wasn't necessary to set the home page language name and make it active. Instead, I could just create a specific name for a page beneath the home page (e.g. /test/ for the default language, and /test-fr/ for French), and mark that language as active just for that page, and it would work, displaying the language specific content for that page. The problem I have is that not all pages are translated - in fact there are just a few - and these might have different combinations of language-specific content. One page might have default (English), French and Spanish content, another page using the same template might have default (English), German and Dutch, for example. Hence I don't want the whole site to have a language prefix at the root for every language - just to have language-specific names for those (few) pages that are affected. Until now, this has worked fine, but since upgrading the site to 3.0.229, only the default (English) language content is being shown for those pages, even when accessed via their language-specific URL. Essentially the detection of the language from the page name is now fully dependent on the home page having that language active (and hence a segment prefix) whereas before it wasn't. Can anybody suggest a way around this? If I replace the core LanguageSupportPageNames module with the version from 3.0.165 then the previous behaviour is restored, but obviously that's not a very robust solution. Thanks. Ian.
  3. Likewise. It's certainly not a deal-breaker, and the showIf fix is a big step forward for my needs. 👍
  4. Thanks @bernhard, looks like this is now fixed. I'll mark this topic as solved.
  5. @bernhard, showIf conditions are now working as expected. These are working in all three edit modes: Full page edit, block "edit in new window" and front-end block edit with Alfred. However, This is not working for me when editing a block in full page edit mode. If a requiredIf condition is met, then none of the block's changes are persisted. When editing a block via "edit in new window" or front-end with Alfred, the requiredIf conditions work and the changes are saved. Sorry to be a pain - I think we're almost there, but I can't for the life of me figure out why this is happening only in the full page edit scenario. I can create a screencast demonstrating the issue if that would be helpful. Thx, Ian.
  6. Hi @bernhard, Just revisiting this. I hadn't noticed, but @Klenkes is correct - the orphaned block deletion is broken again in newer versions of RockPageBuilder. It did work up to at least v5.0.3 but it looks like an extra check was later added in getUnusedBlockIds(): // never delete blocks younger than 10s 'created>' => time() + 10, Which I believe is saying "find unused blocks that also have a created time newer than 10 seconds in the future". Hence it's not going to find any. Changing to this: // never delete blocks younger than 10s 'created<' => time() - 10, Appears to resolve the problem, and I think is doing what the comment says? Thx, Ian.
  7. iank

    Dynamic CSS

    The TailwindCSS JIT compiler scans the source code rather than the html output, so it's looking for full class names in your PHP code. Hence you could do something like this: <?php namespace Processwire; $bg = $page->bgSetting === "success" ? "bg-green-500" : "bg-red-500"; ?> <div class="mt-4 max-w-md <?= $bg ?>"> Lorem ipsum dolor sit amet consectetur adipisicing </div> Or you could simply fake safelisting the expected values, e.g. in a comment if you just have a few you want to make available in a template: <?php namespace Processwire; $bg = $page->bgSetting === "success" ? "green-500" : "red-500"; /** safelist values: bg-red-500 bg-green-500 bg-blue-500 */ ?> <div class="mt-4 max-w-md bg-<?= $bg ?>"> Lorem ipsum dolor sit amet consectetur adipisicing </div> As long as the full string of the class name is in the code, it will get compiled by TW (use spaces between if you're using this method though, as if you were adding classes directly). (Of course there's also Tailwind's safelist setting in the tailwind.config file: https://tailwindcss.com/docs/content-configuration#safelisting-classes) Ian.
  8. Hi @bernhard, I discovered some more information which might help with troubleshooting. I came across this post which seemed to be related: https://processwire.com/talk/topic/29225-solved-show-this-field-only-if-doesnt-seem-to-work/. As mentioned in that post, if I use Alfred on the front end, or choose "Edit in new window" from the admin side, the changed information does indeed get saved. Only when editing the blocks in the admin in 'repeater mode' does the 'showIf' information not get saved. I hope that points you in the right direction (and for now I have a workaround!) Thx, Ian.
  9. Edit: OK, I think we can ignore the dependent field types involved (page reference, Fieldset (page)) - a simple example with just a checkbox and a textarea exhibits the same problem. It definitely looks to be something related to the "showIf" condition rather than the underlying fields: ----------------- Hi @bernhard, sorry to be a pain. In fact, I have the same problem if the dependent field is a FieldtypeFieldsetPage, as in this example: This example is part of a Call to Action block. The 'Action' field is a Select Options field, and the 'Link to Page' field is the Fieldset (Page) field containing the three nested fields you can see. None of those three fields are saved when the block or page is saved. I think it must be something to do with the 'showIf' logic. Again this logic is just moved over from a RepeaterMatrix field where it worked just fine. Thx, Ian.
  10. Hey @bernhard, RPB is so great I decided to migrate from RepeaterMatrix for a site I'm working on 🙂 However, I came across a snag with a page reference field not saving to the DB. I have a fairly basic 'RichText' block which in addition to the basic title/textarea fields has a checkbox to show a page reference page (single page) via a showIf condition. If the checkbox is checked, the page reference field is shown: But when the block (or parent page) is saved, the chosen option doesn't get saved. I know the page reference field works, because this is exactly the same logic (using the same fields) I've ported across from my RepeaterMatrix field. Furthermore, if I disable the "showIf" condition in the RPB block, the page reference once again works correctly. In the example above, I'm using a select dropdown, but I get the same behaviour if it's a Radio Buttons list. Any thoughts? Much appreciated, Ian.
  11. Thanks @bernhard, only just got around to this, but all good now. 👍
  12. Hey @bernhard, Any suggestions how to stop the RPB log from filling up with these messages? They seem to occur every few seconds. I also from time to time see a warning in the Admin along similar lines, but I'm not using Less. I just noticed the log had > 14000 such messages, so I pruned it and already a short while later it's up to 40! Many thanks, Ian.
  13. Hi @bernhard, Many thanks. Yes, the update to v5.0.0 has certainly fixed that issue. Yes, I definitely do 🙂 I like the drag 'n' drop sorting too, although it can be a little difficult to know whether you're dropping in the right place when you have blocks that are quite long on the page. At least you can still do it the 'old' way as well, on the admin page edit screen. Many thanks for the quick response!
  14. Hi @bernhard, Hope I can explain this well enough: I have several RPB blocks that contain image fields (some are single image, others multiple images). I used your VScode snippets to create the image field in the block's $rm->migrate() method, e.g: self::image => [ 'type' => 'image', 'label' => 'Image', 'maxFiles' => 1, 'descriptionRows' => 1, 'extensions' => 'jpg jpeg png', 'maxSize' => 3, // max 3 megapixels 'maxWidth' => 1200, 'maxHeight' => 1200, 'icon' => 'picture-o', 'outputFormat' => FieldtypeFile::outputFormatSingle, 'gridMode' => 'grid', // left, list ], But when I then add a new block to a page from the admin, it seems the image field isn't ready to accept images, either via the "Choose File" button, or via drag and drop. In fact it looks like this: The Choose File button allows the selection of a file, but nothing is uploaded, and dragging/dropping does nothing. There are no JS errors in the console. If however I save the page, the field seems to resolve itself and is then able to receive images: I've tried various options, including saving the field again in the Admin, and copying/pasting the full RockMigrations Code from the field's Basics tab, but to no avail. Have you any ideas? Many thanks in advance, Ian.
  15. @bernhard, That works, yes, but only if you update the $file = Paths::normalizeSeparators($step['file']); in the getTplPath() method as well, as you suggested earlier..
  16. Hey @bernhard, I think I've found the problem. It's relating to the fact that the view file extension can be either .latte or .view.php (I'm using the .view.php version). The logic for finding the php file edit link is stripping the view file extension and then adding back ".php". This works if it's a .latte view file, but not for .view.php files. In this case, it simply strips off the last part (.php) and adds it back, so we still have the .view.php in the full path. I added this line to ___getIcons() which fixes the problem, though there might be a more elegant solution: $ext = pathinfo($opt->path, PATHINFO_EXTENSION); // php file edit link; view file can be .latte or .view.php $php = substr($opt->path, 0, strlen($ext) * -1 - 1) . ".php"; $php = str_ireplace("view.php", "php", $php); // <============== if it's a .view.php file if (is_file($php)) { .... Regards, Ian.
  17. Hi @bernhard, Sorry for the delay. Here's what I'm getting: Thx, Ian.
  18. Almost! Both the icons now point to the [BlockName].view.php file. I presume one should point to the [BlockName].php and one to the [BlockName].view.php file ?? I'm just using straight PHP for my blocks, not Latte. Thx, Ian.
  19. Hi @bernhard, I've just encountered another issue, possibly because I'm working locally with Windows. The vscode block development shortcuts for Superusers aren't linking to the block view and block php files. Specifically these: They seem to both default to pointing at the \site\modules\RockFrontend\RockFrontend.module.php rather than the individual block/view files. I'm not sure why; maybe it's a difference in the information that debug_backtrace() returns on a Windows system? I don't know if this dump of the backtrace from getTplPath() is helpful: The icons seem to be using the first 'file' entry, although the link to the view file is there... Thanks in advance, Ian.
  20. You're welcome! 😁. I can confirm that this solves the issue. Orphaned blocks are indeed removed when the page is saved. Thanks! Ian.
  21. Hey @bernhard, me again! When developing a new block, I was adding it to a page repeatedly, but not saving the page. Instead I would cancel editing and ignore the 'changes not saved' popup, to add more features to the block and try it again. I then realised that this was creating pages under the RockPageBuilderBlocks tree that seemed to be orphaned, containing just my default settings. Of course I can delete these pages, but do you think there might be a way to identify any such orphaned blocks and remove them automatically? Thx, Ian.
  22. Hi @bernhard, Yes, I can confirm that fixes the issue. Thanks! Ian.
  23. Hey @bernhard, Not urgent, but I discovered a slight glitch when trying to delete a block from the dropdown on the module config page, which appears to be down to the backslash notation in Windows (I develop locally on Windows). The getFiles() method of Block.php doesn't find any matching files on a Windows setup. The path returned by the dirname($file) call is returning something like this: 'D:\laragon\www\sitename\site\templates\RockPageBuilder\blocks_general\IanTest/IanTest' whereas the wire->files->find->($dir) returns file paths corrected for backslashes like this: 'D:/laragon/www/sitename/site/templates/RockPageBuilder/blocks_general/IanTest/IanTest.view.php' If I correct the backslashes as follows on line 340, it works just fine: $dir = str_replace("\\", "/", dirname($file)); No rush - deleting the block files manually and doing a modules refresh works in the meantime. Cheers, Ian.
  24. Aha, yes, that's it! 👍 I have a rich text summary field called "global_summary_rich" that I'm using across blocks. $block->edit('global_summary_rich'); //works $block->global_summary_rich(); //doesn't work $block->rich(); //works Thanks @bernhard. Now I know. I might have to re-think my naming convention though..
  25. Thanks @bernhard, that's a good start! It seems that $block->edit('something') does work for those (textarea/tinyMCE) fields, but $block->something() doesn't. Yet it works for plain text fields. I can see in the source that calling $block->something() for a textarea field doesn't output any of the frontend stuff (pw-editcopy, contenteditable etc.). I expect this isn't a RockPageBuilder problem but something else; I just haven't figured it out yet. At least I can get it to work with the more verbose version. I did touch the frontend edit module settings briefly, but only after I encountered this problem; I thought maybe I had to switch on editing for those fields; that didn't make any difference so I turned it off again. If I can diagnose the problem I'll post back with further details. I'm running PW 3.0.229, RPB 4.7.2, PHP 8.2
×
×
  • Create New...