Leaderboard
Popular Content
Showing content with the highest reputation since 03/08/2025 in Posts
-
Work continues on the new processwire.com website. I’ve nearly finished developing most of the modules directory this week and next week will be working on the development side of the API reference and sites directory. Some more good news to share is that when the new site launches, the new admin look and feel will launch as well. The website and admin share a similar design language in some areas, and I’m confident you will love them both. When we use screenshots of ProcessWire in the new site design, they will be from the new admin look and feel. It is still admin AdminThemeUikit, but with a new face that is beautiful, modern and professionally designed. I’ve been using for more than a week and it’s fantastic in my opinion. If for some reason you end up wanting to keep the current look of AdminThemeUikit (perhaps a client doesn’t like change), it will remain as an option too. If you are extending AdminThemeUikit or using the admin.less feature (developed by Bernhard) to custom style the admin, all of that will continue working too. What will likely be changing is that we’ll be moving the older AdminThemeDefault and AdminThemeReno out of the core and into the modules directory. I’d rather keep the core efforts focused with AdminThemeUikit, but continue to support the older admin themes as installable options. Prior to this, most of what you’d seen in ProcessWire’s core admin and website has been designed by me (excluding AdminThemeReno). And I haven’t worked full time as a designer since 2005 or so. If I ever had any site design skills, they are long gone. So PW has always had a “designed by a developer” look. Having professional designers take over the design of both the admin and the website just feels like a major upgrade to ProcessWire all around. More than I could have guessed. I look forward to when I can share the new site design, admin look and feel, and the designers with you. Thanks for reading and have a great weekend!17 points
-
Hey Ryan! First of all, this all sounds very promising. In my humble opinion you are vastly underplaying your own skill in terms of design, but that's also why we can trust that you'll recognize amazing design once you see it. Looking forward to seeing what the team working on the design has cooked up 😉 Now, please forgive me for jumping directly into asking for stuff, but... I know this is small thing, but it would be quite nice if the new admin made use of CSS variables wherever it makes sense; colors, font sizing, etc. (Or provided them as an alternative for non-core tools to use, in case it is not feasible to use them for actual admin styling.) The reason I'm saying this is that I've built various admin tools that I wanted to look like the admin theme, and since there is (to my knowledge) currently no simple way to access existing colors etc. in CSS, any non-Uikit elements I've had to "hard-code" to use current styles. This includes the default green/cyan/blue color theme, current spacing and font size practices, etc. As a result said custom elements may look out of place once the theme is updated 🙂 (Just for the record: SCSS/LESS might be an option, but that feels like a lot of unnecessary overhead and complexity where vanilla CSS would easily suffice. I'd really like to avoid that if possible, and to me it seems like CSS variables are an easy and well supported alternative.) Additionally: it would be awesome if accessibility was a consideration while creating this new admin theme. I know it has been considered to a point in the past, but has never been a major goal. Hopefully we can push things forward in this regard in the future. If there's something I can help, I'd be happy to 🙏16 points
-
Hey everyone! Fluency v2.1.0 has been released with new features and bugfixes. Translation cache now caches translations permanently until cleared on the module config page when translation caching is enabled. Some Fluency methods are now hookable. Refer to README for documentation and use case. Credit to @Hari KT for inspiring this feature. Globally excluded strings can now be entered either one per line or all on one line separated by a || (double pipe). Credit to @bernhard for the feature suggestion Translating static strings using the ProcessWire translator now offers the ability to specify the language code to be used for the source language Fix issue where strings configured to be excluded from translations on the module config page were being translated. Credit to @bernhard for finding and reporting Correct issue where custom language code field that may optionally be added to ProcessWire language pages was inconsistent and incorrectly documented. Fix missing localization strings for some errors Various small improvements, some bugs that had not yet affected regular usage Various housekeeping and code cleanup that only matters if you like reading the source 🤷♂️ Thanks all, and please report any issues!6 points
-
I think this approach is an excellent idea and hopefully something that will be considered. In addition to the benefits @teppo described, using CSS really open things up for JS as well where getting/setting values via scripts could make admin development very dynamic. Laying some future friendly groundwork in CSS would be a major advancement.6 points
-
@ryan Makes sense. Really looking forward to seeing what y'all been cooking up! I paused the other day and appreciated all the quality of life improvements that have come over the years and value them as much as the big features. Almost can't wait. It's like Christmas for adults, who are also developers.5 points
-
@teppo Thanks and good ideas. CSS variables sound good to me too. But want to mention that this isn't a new admin theme, this is AdminThemeUikit with an improved look and feel. There isn't any change to the underlying markup or CSS structure. The AdminThemeUikit CSS is still present so folks can still use the original look too. Longer term maybe we'll do a whole new admin theme. This does actually feel like a new admin theme when you use it, even if it's technically not.5 points
-
Great news! @ryan, for a completely new admin project, might you consider using HTMX, or something similar? It's perfect for PHP. I've used it on a large admin project, and it works wonders with ProcessWire. I also use these libraries to complete the package: https://github.com/gnat/css-scope-inline https://github.com/gnat/surreal4 points
-
@Macrura, I'm not sure if your issue is the same as the caching issue that @adrian recently reported in the GitHub repo, but I've found a way to do some cache-busting in v0.5.2 so please try upgrading and see if that solves it. If not, could you please open a GitHub issue and we can continue the conversation there?3 points
-
You know that Padloper is not free? You have to buy a license for it, then there are the downloads 😉3 points
-
There is a long open issue for UIkit to support CSS variables but unfortunately there seem to be no efforts in that direction: https://github.com/uikit/uikit/issues/45343 points
-
maybe i'm a bit late to the party ... 🙂 in an old wordpress instance i'm just transferring into a PW project, i've used a PDF page flip plugin. i found out it can be used also barebone (based on jquery). i just implemented it succcessfully into a PW page with a PDF file upload. it can be found here: https://dearflip.com/ there's a free/lite/non-commercial version here: https://github.com/dearhive/dearflip-js-flipbook maybe it's interesting ...3 points
-
Things I love: its not wordpress - mostly a security issue this one easily get CMS data and role your own php / frontend to display / do something with it... anything you can imagine modules making is approuchable (though could do with a good user guide as they're changed quite abit over the years) community is great! doesn't break, or need upgrading very often3 points
-
Thanks for the clarification! Still hoping that we can make some minor improvements, though. Loosely related, but I'm not sure if you've noticed that there is a are a couple of comments related to one recent admin change 🙂 That sounds a bit disheartening. I've never actually built anything from scratch with Uikit so I'm not too familiar with its structure, and I must admit that digging into AdminThemeUikit just now made my head spin, but it looks like variables are defined mostly in one place. Is that right, and if so, would it be an option to set those based on CSS variables? That might not work with — or rather stay in sync with — custom admin styles, though. Of course there's always the option of somehow duplicating LESS variables to CSS variables. This way they could at least be used in modules etc.2 points
-
@Robin S - I was just testing on a different site (where I hadn't yet checked the clear network cache) and came across the same error that @Macrura reported above. I just updated to 0.5.2 and that seems to have fixed that along with the issue I reported. Thank you!2 points
-
2 points
-
Prompted by @ryan's recent enhancement of the page tree display, I wanted to display an alphabetical index of pages rather than a numerical one, so I built a hook after MarkupPagerNav::render. You can see the result here: https://ncorchards.co.uk/main/fruit-orchards/apples/ Basically the hook just replaces render() with a modified version. The key modifications are to select all the items without limit: $items = $event->arguments(0); //PageArray $itemSelector = $items->getSelectors(true); // true returns the string rather than the object $noLimit = preg_replace('/,\s*limit=-?\d+/i', '', $itemSelector); and then to modify the pager: $pagerNav = new PagerNav($object->totalItems, $object->itemsPerPage, $object->pageNum); $pagerNav->setLabels($objectOptions['previousItemLabel'], $objectOptions['nextItemLabel']); $pagerNav->setNumPageLinks($object->numPageLinks); $pager = $pagerNav->getPager(); $allItems = $this->find($noLimit)->explode('title'); $itemsPerPage = $object->itemsPerPage; foreach($pager as $key => $item) { if(!ctype_digit("$item->label")) continue; $index = (int) $item->label; $itemTitle = $allItems[($index - 1) * $itemsPerPage]; $item->label = substr($itemTitle, 0, 2); } If anyone wants the full hook code, let me know, but you will probably want to modify it for your own use anyway and the above are the key bits.2 points
-
2 points
-
@wbmnfktr It's funny that you say that, because this is exactly what I told the designers the first time I saw what they did with the admin theme. I told them that what they did with ProcessWire feels like home. Not just home, but a nicer and more modern home. 🙂2 points
-
2 points
-
Hi Teppo, Would it be possible to make the 'isRepeatableField' in Indexer.php method hookable. I would like to attach our FieldType 'FieldtypePageTableNext'. That would be great. ?2 points
-
Hey @BrendonKoz, Thanks for the tip. No, I haven’t tried anything yet. Been busy these last weeks. I’ll try your solution. Thanks again.1 point
-
I guess that YOOtheme probably will implement CSS variables with UIkit 4. Here is an open issue for ideas and suggestions for UIkit 4: https://github.com/uikit/uikit/issues/3967 Yes, there is one partial file for variables, but I don't think you can easily change every variable to a CSS variable. Some variables use for example darken() and lighten() which I think don't work with CSS variables. I have tried it once, for some variables it is possible but for most not. One simple enhancement I mentioned several times over the years would be to include the CSS source map in the AdminTheme. But it seems that I am only one with this wish. 😅1 point
-
1 point
-
Looks like I've got some catching up to do here 🙊 Thanks for reporting this. It should now be fixed in the latest version of the module!1 point
-
Sorry, I don't have any ideas why the challenge is getting corrupted like that but there is something in the back of my brain saying it's seen something similar before - if I remember, I'll let you know. On a side note, have you seen this WebAuthn module: https://processwire.com/modules/tfa-web-authn/1 point
-
1 point
-
1 point
-
Hey @TomPich, I don't know if you gave it a try, but I just did. Although I was able to get the button to work after manually modifying InputfieldTinyMCEConfig.php, I wasn't able to get it to actually work using the default interface of a Textarea field's Input config for TinyMCE fields. As the Accordion plugin is not an external plugin, there doesn't seem to be a simple way to use the UI of the field's Input config settings to enable the accordion. I played around a bit, and did get it to work, but after saving the injected "accordion" (details/summary elements), the HTML of those elements got stripped via HTMLPurifier, so there's another problem. Turning off HTMLPurifier allowed it to work, though I'm not sure if you'd want to do that. There's another recent topic where someone is attempting to adjust HTMLPurifier a bit. Currently, it seems that to get the Accordion plugin to work until/unless the core TinyMCE module is updated to include it, you'd currently have to migrate your customized settings via the field's UI into a custom JSON that overrides what you have set via the field UI. Example "Custom Settings JSON" (PW default + accordion): { "plugins": ["anchor", "code", "link", "lists", "pwimage", "pwlink", "table", "accordion"], "toolbar": ["styles bold italic pwlink pwimage blockquote hr bullist numlist table anchor code accordion"] } After playing around with the accordion interface, I don't find it quite as intuitive as some other elements, but it does work.1 point
-
@taotoo just a guess, try these: template=category >> parent=/blog/posts, categories=parent.id or template=category >> parent=/blog/posts, categories=page.parent.id1 point
-
1 point
-
Hey @teppo no I didn't dig deeper to be honest 😇 But your buffering note makes sense and when working with SSE on RockCalendar with DDEV I think it worked without any strpad or such!1 point
-
Have you changed the variable “$config->httpHosts” in your config.php so that it contains your local url?1 point
-
Do you have the same userAuthSalt in config.php? If you change that (or it does not exist) you'll not be able to use the same password. You can also reset/force-login like this: https://processwire.com/talk/topic/29593-solved-do-the-reset-password-tricks-work-for-you-they-dont-work-for-me/?do=findComment&comment=239355 But it would be better if you understand why it does not work and then fix it if needed 🙂1 point
-
I've decided to just create a custom module for this functionailty, still have no idea what the white page is all about though.1 point
-
Wow. No, I’m sorry that I seem to be writing so unclearly. When you write: you are correctly describing the current situation. --- The whole point is that I want to open the system up for users around the world — regular people — who will be setting their preferences, creating public user profiles, tagging things privately for their own use, storing private notes. All using front-end forms and (probably) htmx. Because servers occasionally go down and people sometimes travel, I need this data to be on all the servers.1 point
-
Hey @neophron RockFrontend doesn't change the _main.php file. I guess you mean the RockFrontend Site Profile?! Whatever. As I told you at the very beginning you need to remove all styles() and scripts() calls and add assets manually. How you do that is up to you. You can either add the script/style tags manually to your main markup file or you can use RockDevTools. It's really up to you. But unless you remove all styles() and script() calls your system will not work and is not expected to work. There might be some inconsistencies with the site profile or other references to that old concept. I'm sorry for that and I'm trying my best to remove all those outdated informations. For that it would help to get the exact steps you took to get where you are. I understand that this might be frustrating, but please also understand that it is frustrating for me to try to help but don't get proper information and searching in the dark for issues that I don't see. What is that status on your end? Did you get it working already? What did you try to make it work? I'm very busy until end of next week so it would be nice to get an as detailed report as possible. Alternatively I can offer you that you send me your project and I set everything up so that it works.1 point
-
Hi everyone! I've started working on a new module that contains development tools like asset minification. Why a new module when RockFrontend and RockMigrations already have similar features? I wanted to start fresh to make the code cleaner, and most importantly make it work properly with template cache! The old implementation in RockFrontend using page render hooks simply couldn't handle that. The module is intended for development-only and should be disabled on production. The idea is to create minified assets while developing and then push the minified assets to production and there just include them in your markup! LiveReload has also been moved from RockFrontend to this module. It's simply not a frontend-tool but rather a development tool! Using RockMigrations, for example, I'm always using the LiveReload feature on the backend, so it does not really make sense to have it in the frontend module 🙂 Download & Docs: baumrock.com/RockDevTools1 point
-
I've done something like this once, neatly grouped in chapters, with screenshots and even short video-captures. Everything the client needed was covered. Problem was... that particular client mostly forgot to look it up in the first place - even though that manual wasn't hidden away in some obscure place, or distributed as a separate file. It lived right there in the PW admin as a custom admin page. I'd share it here, but a) it was in german, b) the site's setup is way too custom-tailored to make sense for most other people and c) it uses pro modules like Form Builder and Lister Pro. Also, afair the screenshots contain sensitive information, and the rich-text editor in use was CKE with a non-standard choice of buttons. I'm not sure I would ever do such a manual again, seeing how much work went into it, and how easily it can be overlooked. I would invest my time even more into UX; e.g. for some sites, it makes sense to completely hide the page-tree. Also, use field labels and hint texts liberally. Hide, rename or otherwise simplify admin stuff (hooks? Admin On Steroids - or whatever the successor is called now? there's plenty of tools and examples around). Some stuff is right there in the core, e.g. restrict templates by page-tree, or disable changing the template etc.1 point
-
1 point
-
@bernhard Apologies for the delay! I've pushed updates to the dev branch. I had a few changes that were already going into the next version that I had to do some extra testing for and a lot of housekeeping. Let me know if this works as well for you as it did me and I'll push another version to main https://github.com/SkyLundy/Fluency/tree/development New feature that some may be interested in- adding DeepL languages for translation that are technically supported by their API but not delivered by the languages endpoint yet. You can read more about when that happens and why on this DeepL documentation page. To manually define languages in Fluency that are supported for translation, you can use a hook. This will make the language available both within the global translation tool as well as available for configuration with a ProcessWire language on the module config page. <?php namespace ProcessWire; // ready.php use Fluency\DataTransferObjects\{EngineLanguageData, EngineTranslatableLanguagesData}; // Hook after Fluency gets the available languages from the DeepL API wire()->addHookAfter('Fluency::getTranslatableLanguages', function (HookEvent $e) { // $e->return is an instance of EngineTranslatableLanguageData // The `languages` property returns an array of EngineLanguageData objects $languages = $e->return->languages; // Create a new data object, define the values according to the API docs, add it to the original languages array $languages[] = EngineLanguageData::fromArray([ 'sourceName' => __('Arabic'), 'sourceCode' => 'AR', 'targetName' => __('Arabic'), 'targetCode' => 'AR', 'meta' => [ 'supports_formality' => false, // This is determined by DeepL, check to see if it's available in their API docs ], ]); // Instantiate a new EngineTranslatableLanguageData object with the language array then assign it to the return value $e->return = EngineTranslatableLanguagesData::fromArray([ 'languages' => $languages ]); }); @Hari KT This is a new method supported by Fluency to add Arabic to Fluency before DeepL lists it for translation. Thank you for inspiring a solution with your Github issue on languages not being available in Fluency. This is available on the dev branch of the Fluency repo if you would like to help test it out @ryangorley This will address the issue you had with Traditional Chinese, albeit a lot later than may be useful for you, but the hook above can be modified to resolve that problem. I'm surprised how long the language had been listed as "available soon" on their API documentation 🤷♂️ I would have gone this route sooner had I known there was some documentation about this, I don't think it existed at the time.1 point
-
Ever felt like your ProcessWire emails look like they're stuck in 1999? You know the drill - sending emails is super easy with WireMail: $m = new WireMail(); $m->from('foo@bar.com'); $m->to('xxx@yyy.com'); $m->subject('Hello there!'); $m->bodyHTML('<h1>This is great!</h1><p>I am an ugly mail...</p>'); $m->send(); But let's be honest - they look about as pretty as a website built with Microsoft FrontPage! 😅 🪄 Enter the Mail Pimp Hook! Drop this magical hook into your /site/ready.php (or even better Site.module.php), and watch your emails transform from ugly ducklings into beautiful swans: <?php $wire->addHookBefore('WireMail::send', function(HookEvent $event) { // double check that we got a wiremail instance // this also tells the IDE what $mail is (to get IntelliSense) $mail = $event->object; if (!$mail instanceof WireMail) return; // get current mail body $html = $mail->get('bodyHTML'); if (!$html) return; // get email layout markup $layoutFile = wire()->config->paths->templates . 'mails/default.html'; if (!is_file($layoutFile)) return; // replace ##content## with actual mail content $html = str_replace( '##content##', $html, wire()->files->render($layoutFile) ); // write new body to mail $mail->bodyHTML($html); }); The HTML Just create a beautiful MJML template at /site/templates/mails/default.mjml, put ##content## where your email content should go, convert it to HTML and BOOM! 💥 Every email gets automatically wrapped in your gorgeous template. No more CSS wrestling matches, no more "Why does this look different in Outlook?" headaches. Just pure email beauty, automagically! ✨ Now your clients will think you spent days crafting those emails, when in reality, you're sipping coffee while your hook does all the heavy lifting. Work smarter, not harder! 🚀 #ProcessWire #EmailMagic #NoMoreUglyEmails PS: This is the MJML template that I used: <mjml> <mj-head> <mj-attributes> <mj-all font-family="Tahoma" /> <mj-text line-height="140%" /> </mj-attributes> </mj-head> <mj-body background-color="#efefef"> <mj-section background-color="#ffffff" background-repeat="repeat" padding-bottom="30px" padding-top="30px" text-align="center" > <mj-column> <mj-image align="center" padding="25px" src="xxx" target="_blank" width="200px" alt="Logo" ></mj-image> <mj-text>##content##</mj-text> </mj-column> </mj-section> <mj-section> <mj-column> <mj-text font-size="10px" color="#a0a0a0" align="center" > powered by <a href="https://www.baumrock.com/" style="color: #158f66" >baumrock.com</a > </mj-text> </mj-column> </mj-section> </mj-body> </mjml> VSCode has an extension to get a live preview and export MJML to HTML: And here are some other free templates: https://mjml.io/templates I use https://www.base64-image.de/ to add the logo to my mail template as src="data:image/jpeg;base64,/9j/4QAWRXhpZgAATU0AKgAAAA..." to avoid headaches with image paths, remote assets blocking etc.1 point
-
Hello! I trashed a page and when I checked the Trash to restore it I noticed that there is no "restore" button on it. Not even a "view" button. There is only "edit" and "move". If I set the page to "Unpublished" while on trash only then the "view" button appears but still there is no "restore" button at all. The page belongs to a template that is used for children. I'm using a brand new ProcessWire installation 3.0.244. Also, upgraded it to 3.0.245 and the issue remains. I do not have that issue on a website with 3.0.229. EDIT: While I'm using 3.0.245 now, I created a new children page and then trashed it and the "restore" / "view" buttons are now visible.1 point
-
This week on the dev branch are 8 issue resolutions. The most significant one #2035 (found by @Jonathan Lahijani) is that when you trash a page with children, and then later restore it, the page gets restored correctly, but the children/descendants only partially get restored. By that I mean that the children would get moved out of the trash, but they'd continue to have trash status. So those pages could silently behave like they were in the trash, making them visible in the PageList but otherwise inaccessible. There wasn't really any way to fix it interactively, since you can't manually assign or un-assign trash status, at least not without using the API. While I suspect this bug has been around for a very long time, I couldn't find any installations where I had trashed and restored a nested structure of pages like this, but was able to reproduce it manually. Just in case any of your installations have pages like that, the PageList (as of this week's commits) now highlights them with both trash and warning icons. Fixing the issue is just a matter of editing the page and clicking Save. If you want to quickly check if you have any pages affected by the issue (in almost any PW version), you can paste in the following URL, assuming /processwire/ is the path to your admin: /processwire/page/search/for?status=trash&has_parent!=7&include=all While it might be rare to trash and restore a structure of pages, I want to make sure nobody is affected by it so I'll likely update the current main/master version within the next week, merging the current dev branch. Coming in ProcessWire 3.0.246 is support for another type of conditional hook which enables you to match the return value, or properties of the return value, for any hooked method. Currently conditional hooks let you match things from the object being hooked, or the arguments of the method being hooked, but it's not previously been possible to match the return value of of methods with conditional hooks. Next week it will be, which I think as a useful improvement to our hooks system. More on that next week. Thanks for reading and have a great weekend!1 point
-
Nice. Just wanted to mention Cerberus as an alternative to MJML if you want to use email-friendly HTML templates directly.1 point
-
Season's Greetings ProcessWirers! I hope you enjoy the gift of this module, but use with care... TLDR: This module captures changes made in the development environment so that they can be easily migrated to the live environment without needing to specify the changes or write any code. The demo below gives a brief overview. Want to read? Read on. One of the (few) problems with ProcessWire, in my opinion, is the lack of any native way of handling migrations. Given that PW is such a powerful tool capable of sophisticated and complex web-based applications, this is less than ideal. There is a solution, however, in RockMigrations which accomplishes a lot in a controllable way, provided you are happy to specify your database set-up in code rather than via the UI (albeit that the latest versions allow you to grab much of the required code from the UI). If that suits your need, great. Around the same time as the first versions of RockMigrations, I started developing my own UI-based migrations module, which I have been using with reasonable success for some time. I halted development of the module for a while as RockMigrations developed and I considered switching to that route. However, I decided that my module suited me better and that a real improvement could be made if it was effectively automated so that I no longer needed to specify a migration. So that is exactly what it does: after configuring the module, you add a new migration page with ‘log changes’ enabled (which includes determining what types of objects are relevant for the migration) and work on your development system. Once you have made the desired changes (and tested them!) in the development environment, you go back to the migration page where it has magically captured the objects which have changed and listed them in dependency order. You then ‘export’ the changes, which creates json files to be uploaded to the live environment (via Git or FTP etc.), where they are then ‘installed’ to re-create the changes in the live system. The demo below illustrates this briefly. This first demo shows the creation of a migration. The installation demo will be in the next post, because of size constraints. See post 4 for HD video. Video-source small.mp4 There is a very extensive manual which covers all the features of the module, not just this ‘automatic’ method. Available on github at https://github.com/MetaTunes/ProcessDbMigrate and in the modules library here. PLEASE NOTE that this is still in 'alpha'. Do not use in production without fully testing and backing up at every stage. It is quite complex so, although I have tried hard to eliminate bugs, there will inevitably be some left!1 point
-
Hi. I just upgraded my installation of dedicated server to PHP 8.4 and latest PW and Search Engine is showing this errors: It seems that it is some problems with selector with null ? I found some fix for this: https://dev.to/gromnan/fix-php-84-deprecation-implicitly-marking-parameter-as-nullable-is-deprecated-the-explicit-nullable-type-must-be-used-instead-5gp3 So I have to set some default value or is needed to be in code of module? Your module is working right anyway and is amazing for searching - so I just need to know if I could just ignore this for now... Thanks for any help.1 point
-
I ended up modifying the module (FieldtypeSecureFile) of Wanze to my needs. Wanze's module doesn't delete the files nor the sub-directories where the files are in. Also, the module didn't work in the latest version of PW. Now it does, but I don't know about the old versions (and I don't care). I left out the download part and the roles, because I don't need that. I'm sure there are some things that could be approved in the code, but it works for me. I can now safely upload and delete files in a directory outside the webroot. Example: /home/username/securedir The link to the module: FieldtypeSecureFile (GitHub)1 point
-
@virtualgadjo I was able to find a similar conversation on a RPB module support thread and put something together. I did take an idea from you using the Pages::saveReady event rather than the Pages::saved event in that example which I like better. Same setup with the extra field as you have done. In case this helps anyone else, here's what I came up with. It may be useful outside of the context of RockPageBuilder where field types matter. /** * Adds any content in RockPageBuilder field blocks to the dedicated indexable search_engine_block * field that it then added to the search index */ $wire->addHookBefore('Pages::saveReady', function($event) { $page = $event->arguments(0); // Get only RPB fields if they exist $rpbFields = array_filter($page->fields->getArray(), function(Field $field) { return $field->type instanceof FieldTypeRockPageBuilder; }); if (!$rpbFields) { return; } // Map RPB fields with values from getSearchIndexValues method if it exists on the child block $indexableContent = array_map(function(Field $rpbField) use ($page) { $blocks = $page->getFormatted($rpbField->name)->getArray(); // Merge content for each block within a field into a single array return array_reduce($blocks, function($values, $block) { if (!method_exists($block, 'getSearchIndexValues')) { return $values; } return $values = [...$values, ...$block->getSearchIndexValues()]; }, []); }, $rpbFields); // Flatten array of arrays containing index-prepared content $indexableContent = array_merge(...$indexableContent); if ($indexableContent) { // This is where it may be improved to make use of a SearchEngine method $page->search_index_blocks = implode(' ... ', $indexableContent); } }); The last comment is right above where I think it would be useful to see if there's a way to make use of the SearchEngine object to index content. My implode() method is mimicking the format of the search_index field with ' ... ' but deferring that rather than mimicking it would be great. It's not a dealbreaker but it would help keep my code from knowing too much about how SearchEngine works internally. Thanks @virtualgadjo for sharing!1 point
-
The "summary", just in case this was overlooked, isn't (entirely) an in-built feature for the module. It needs to be told what field in your template(s) will be used for the search result summary when rendered. From the documentation on the Modules page, under the "Options" heading, check the render_args property of the module's config, and look for the below: // Summary of each result (in the search results list) is the value of this field. 'result_summary_field' => 'summary', In the config, the "result_summary_field" points to the field used in your instance of ProcessWire this module is being used in that will be used to render the search result template's summary. So if in your templates you either don't have a summary field, or the field you use to define a summary is named differently, you'd need to use whatever value you have for your template(s). If maybe you used something like "short_description" as a page summary field, go with that. If you don't have a summary, you could use a "body" or "content" field, and in the render template use some form of string truncation, such as sanitizer()->truncate($your_summary_field, 80). If you're using JSON, slightly further down is a different section for that: // These settings define the fields used when search results are rendered as JSON. 'results_json_fields' => [ 'title' => 'title', 'desc' => 'summary', 'url' => 'url', ], Does that help at all?1 point
-
You must have something else going on. I just tried it with a custom HomePage class in site/classes/HomePage.php <?php namespace ProcessWire; class HomePage extends Page { public function ready() { bd('ready!'); } } And in ready.php $p = new HomePage(); $p->ready(); And it properly dumps "ready!" to the tracy bar ?1 point