Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/12/2024 in all areas

  1. This week on the dev branch are some fixes and improvements, but we'll likely wait another week before bumping the version number up. Some new hooks have been added to $pages, including moveReady(), restoreReady() and renameReady(), to accompany the existing moved(), restored() and renamed() hooks. There was also some refactoring with the way that some hooks are called from $pages to improve their reliability and cover some edge cases where they might have not been called before. See the dev branch commit log for more. The biggest addition this week is likely the newly added support for custom page classes for repeater items. This was added to respond to a feature request initiated by @thetuningspoon and @Jonathan Lahijani let me know about earlier in the week. Here's how it works. If you have a repeater field named "menu_items" then you could create a class named MenuItemsRepeaterPage in /site/classes/MenuItemsRepeaterPage.php, and it would use your custom class rather than the regular RepeaterPage. Though note it must extend RepeaterPage. <?php namespace ProcessWire; class MenuItemsRepeaterPage extends RepeaterPage { // ... } This works with RepeaterMatrix and FieldsetPage as well, since both are derived from regular repeaters. But since both have their own Page classes you'd want to extend their page classes rather than RepeaterPage. In the case of RepeaterMatrix, it uses a class called RepeaterMatrixPage. So if your Matrix field is named "hello_world" then you'd create /site/classes/HelloWorldRepeaterMatrixPage.php: <?php namespace ProcessWire; class HelloWorldRepeaterMatrixPage extends RepeaterMatrixPage {} If you want a custom class for your FieldsetPage field named "seo" then you could create /site/classes/SeoFieldsetPage.php: <?php namespace ProcessWire; class SeoFieldsetPage extends FieldsetPage {} Let's say that you want to use a custom class without using the naming convention and/or file(s) above. You can tell the fieldtype what class to use for its item(s) like this: inclue_once('/path/to/MyCustomRepeaterPageClass.php'); $field = $fields->get('your_repeater_field'); $field->type->setCustomPageClass($field, 'MyCustomRepeaterPageClass'); In the example above, MyCustomRepeaterPageClass would extend RepeaterPage. You'd probably want to do this during the "init" or "ready" state, or at least sometime before you load any items from your Repeater (or Matrix or FieldsetPage) field. If your custom class is not in the ProcessWire namespace, then you'd want to include the namespace in your call, i.e. setCustomPageClass($field, "\\MyNamespace\\MyCustomClass"); If your custom page class is already in /site/classes/, or some other path where it can be autoloaded, then the include_once() line isn't necessary. (API ref pages for getCustomPageClass and setCustomPageClass). Big thanks this week to typneun Designagentur (https://typneun.de/) for posting more than 20 awesome new sites to our ProcessWire sites directory! That made my day. Thanks for reading, more next week, and have a great weekend!
    8 points
  2. TagsToFolders Github: https://github.com/eprcstudio/TagsToFolders Modules directory: https://processwire.com/modules/tags-to-folders/ This is a small helper tool to visually organise fields/templates into folders in the menu when they are tagged. This is a simple module that can help you declutter your templates/fields menu by organising them in folders using tags. I initially envisionned this module to be used for cases where fields and/or templates were created by modules and thus not polute the ones created by the user.
    4 points
  3. Media Lister Lists images and files from across the site in a sortable and filterable table. For images you can choose between table, small thumbnails and large thumbnails view modes. The module retrieves the data using SQL queries so is able to efficiently list media information for all but the largest of sites. Possible use cases: Check that a nice variety of banner images is used for top-level pages. Find duplicate files/images by sorting by filesize or filename. Find images without descriptions if this is important for use in alt tags. Find large PDF files that would benefit from optimisation. Check for "inappropriate" images, or images that are not "on-brand". Images in small thumbnails view mode Files saved as a bookmark Controls Media type: Choose between Images and Files. View mode: When listing images you can choose between small thumbnails, large thumbnails and table view modes. When in one of the thumbnail view modes you can see information about the image in a tooltip by clicking the "i" icon, or edit the page containing the image by clicking the pencil icon. From pages matching: This field allows you to add filters to limit the pages that the media will be listed for. Add bookmark: Superusers can add bookmarks for the current settings that will be available from the flyout menu for all users. See the bookmarks section below for more information. Column visibility: Choose the columns that appear in the table and in the information tooltip (when in thumbnails mode). Search: Quickly filters the results to show only items that have the search text in any column, whether the column is visible or not. Custom search builder: For more advanced searches where you can combine conditions for specific columns with AND/OR logic. Pagination: You can navigate through the results and set the number of results per page. Reset: Click the "Reset" button at the top right to return to the default settings for Media Lister (or for the current bookmark if applicable). Editing the page that contains the media For any media result click the link in the "Page" column to open the page that contains the media item in Page Edit. When in thumbnail view mode you can click the pencil icon to achieve the same thing. The field that contains the media item will be focused. When a media item is contained within a Repeater field this is indicated by an asterisk at the start of the page title. When opening Page Edit for a media item within a Repeater field the Repeater item will be automatically expanded, including for nested Repeaters. Limitations for values that are merged in the database The module has limited support for multi-language values and custom fields for images/files. In order to be efficient enough to handle large sets of results the module retrieves raw values from the database, and in the case of multi-language values and custom field values ProcessWire stores these in JSON format in a single database column. The module improves the display of this JSON data by extracting the uploadName value into a separate column, substituting custom field labels for field IDs, adding language names where possible, and by transforming the data into a quasi-YAML format for better readability. Some limitation remain though – for example, if you use Page Reference fields in the custom fields then only the page IDs are displayed. Bookmarks Superusers are able to create a bookmark for the current Media Lister settings by expanding the "Add bookmark" field, entering a title for the bookmark, and clicking the "Add bookmark" button. Bookmarks will be visible to all users from the flyout menu. You can delete a bookmark from the module config screen. Module config In the module config screen you can define defaults for controls such as media type, view mode, pagination limit and column visibility. You can also delete bookmarks from the module config screen. https://github.com/Toutouwai/ProcessMediaLister https://processwire.com/modules/process-media-lister/
    3 points
  4. Yesterday I had a chat with @gebeer and he showed me Cursor - The AI First Code Editor. It's based on VSCode, so if you are working with VSCode it will be a very similar experience. It can help you writing docs: It can help you refactoring code: And it can help you writing newsletters (testing that it understands the contest of the file for the prompt): I'm sure it can do much more great stuff. @gebeer mentioned a @docs feature - maybe you want to explain that? ? You can either access the AI with your own OpenAI API key or you can use their free tier or buy a subscription starting from 20$ per month. I'm testing it but so far it looks like a good companion. What it did not do for me is to translate all JSON files in the /de folder to spanish translations in the /es folder. It told me it can't do that directly but gave me a python snippet how I can achieve this. I'm in contact with @FireWire about that ? Have a good weekend! Ah, and if you are not subscribed to Rock Monthly here is the link: https://baumrock.com/rock-monthly/ ?
    2 points
  5. Good to hear @bernhard, that you like Cursor so far. Over the course of the last year, with all that AI hype going on, I have tried several AI assistants integrated into VsCode through extensions. Copilot, Codeium, Cody, Tabby, to name the major ones. Now about 10 days ago I stumbled across Cursor and have worked with it since. Guess, I'm a bit late to the party, seeing how well it is anticipated in the Dev community. Cursor is integrating AI, more specifically OpenAIs GPTs, exceptionally well into the IDE. It is available when you need it, but doesn't get into your way. The UX is extremely good, in my opinion. What makes it really stand out from other solution, is the ability to build indices of your code base and give them as meaningful context to the AI. While other tools can also do this, the process of indexing and referencing the index is very efficient in Cursor. This is great for onboarding to new code bases. Cursor indexes the code and you can ask questions and, in most cases, it will be spot on with it's answers. So you very quickly find your way to the relevant parts of the code for the task at hand. The killer feature that I like the most and that I have not seen in any of the other tools is called Docs. With a simple command '@Docs' you point Cursor to a URL, let's say https://processwire.com/blog/posts/pw-3.0.173/ (URL Hooks documentation) and it will create a vector based index of those docs in the background. You give these docs a custom name, pwUrlHooks. Now you can reference them inside your instructions to the assistant with @pwUrlHooks. This drastically reduces hallucinations and produces very good code suggestions in most cases. I's really fun to watch the AI writing code for you that you can actually use. Cursor itself is free. But you only get like 50 requests a month for free. If you need more, they ask 20$/month. But you can also use your OpenAI API key to have unlimited requests. Then you pay OpenAI, of course. But at least you have the choice. And 20 bucks a month isn't that much after all for the time that this can save you. I'm not affiliated with them in any way. Just find it a pleasure to work with. EDIT: Here's a link to the docs. I couldn't find that on the Cursor website but they seem to be the official docs: https://anysphere.mintlify.app/get-started/moving-from-vsc-to-cursor
    2 points
  6. What a great addition to PW. Thanks @Robin S
    1 point
  7. ... well, more like the indented (conditional) dropdown in the setup menu, otherwise you still have lots of scrolling. TextTags also saves lots of scrolling, as @bernhardsays. Needs a bit more though before making a feature request. BTW @monollonom, I think your module should be in the core! Maybe the best quick solution is to install SelectizeAll by @Robin S
    1 point
  8. Yeah I'm only talking about the selection part. The field would then obviously be added to the list as normal, not listed as tags inside the inputfield.
    1 point
  9. Wouldn't it be better to use InputfieldTextTags instead of the boring select field? That has search capabilities already and when having a lot of fields typing is for sure faster than browsing with the mouse ? Fields could still be prefixed with the tag, for example something like [RockCommerce] Price
    1 point
  10. Hi @mcollean I wonder why you ask a question about installing Moodle in this forum. I don't think you will get the answer you want. Gideon
    1 point
  11. Great module @monollonom. Really pleased to have discovered it recently. Now if only we could do the same for the fields dropdown on the template edit page....
    1 point
  12. Thanks! It’s now updated https://processwire.com/modules/tags-to-folders/ ?
    1 point
  13. Here’s the update @MarkE, let me know if it’s all good (looks fine on my side) and I’ll push the update on github/modules directory TagsToFolders.module.php
    1 point
  14. @MarkE there’s this module I made some time ago https://processwire.com/modules/tags-to-folders/ with one of the latest updates being having the system fields/templates in their own submenu. I could add an option to hide them so I’m taking your question as a feature request ?
    1 point
  15. @Michael Mirula, this module is no longer being actively maintained by the author, but see @adrian's post above yours for a fix you can apply.
    1 point
×
×
  • Create New...