Jump to content

Leaderboard

Popular Content

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

  1. Iconify Icon A bundle of fieldtype, inputfield, and admin helper modules for searching and displaying Iconify icons. Over 200,000 open source vector icons are available for selection. Requires the FileValidatorSvgSanitizer module. Be sure to abide by the license terms of any icons you use. The license of each icon set is viewable on the Iconify website. Fieldtype and inputfield modules When the FieldtypeIconifyIcon and InputfieldIconifyIcon modules are installed you can create a field of type IconifyIcon. Field config options Iconify icon set prefixes: In most cases you will want to define one or more icon set prefixes for the field, to limit the search to those particular icon sets. This is because the number of icons available through Iconify vastly exceeds the maximum of 999 results that can be returned via the Iconify search API. You can find the prefix of an icon set from its URL by browsing at https://icon-sets.iconify.design/. For example, the prefix of the icon set browsable at https://icon-sets.iconify.design/mdi/ is "mdi". Enter the icon set prefixes into the config field separated by commas. Icon preview size: Enter a width/height in pixels for the preview of the selected icon if you want to override the default. Using the inputfield Type an icon name (or part of an icon name) into the search input and a list of matching icons will be displayed. You can hover on an icon in the results to see the set prefix and name of the icon. Click on an icon to select it. If you have not defined any icon set prefixes in the field config then you can limit the search to particular icon sets by entering icon set prefixes into the search input before a colon. For example, entering "mingcute,tabler:flower" would search for icons with "flower" in their name from the "mingcute" and "tabler" icon sets. When the page is saved the selected icon is downloaded from Iconify, sanitized via the FileValidatorSvgSanitizer module, and stored within the /site/assets/iconify/ directory. Icons are not automatically deleted from this directory if they are no longer used in a page value, but if you want to clean up this directory at any point you can delete it and icons will be automatically re-downloaded when they are next needed. The field value The formatted value of a IconifyIcon field is a WireData object with the following properties: set: The icon set prefix name: The icon name path: The path to the icon file url: The URL to the icon file svg: The SVG code of the icon raw: The raw icon value that is stored in the database For example, if your icon field was named "icon" and you were outputting the src attribute of an <img> tag, you would use $page->icon->url. Or if you were outputting inline SVG code you would use $page->icon->svg. The unformatted value of a IconifyIcon field is the raw database value. Normally you won't need to deal with the raw value when using the inputfield, but if you want to use the API to set a field value then the format of the raw value is iconify--[icon set prefix]--[icon name]. Example: iconify--mingcute--flower-line. Example of object properties: Using Iconify icons in the ProcessWire admin Installing the AdminIconifyIcon module allows you to use Iconify icons as field, template or page icons in the ProcessWire admin. Icons used in the ProcessWire admin are monochrome so any colours or shades in selected icons will not be preserved. Module config You can define icon set prefixes and the icon preview size in the module config. These settings are applied to the inputfields used to set Iconify icons for fields and templates. Field and template icons An "Iconify icon" field is added to the Edit Field and Edit Template screens. When this field is populated it overrides any selection in the core "Icon" field and this field is hidden. Page icons To use an Iconify icon as a page icon for admin pages in the ProcessWire menus, create a IconifyIcon field named "page_icon" and add it to the "admin" system template. For any page using the admin template (e.g. a page representing a Lister Pro instance), open it in Page Edit and select an icon in the "page_icon" field. An example of a "Countries" Lister Pro instance with an Iconify icon: https://github.com/Toutouwai/FieldtypeIconifyIcon https://processwire.com/modules/fieldtype-iconify-icon/
    14 points
  2. You can check out this module: https://processwire.com/modules/breadcrumb-dropdowns/
    1 point
  3. Since version 3.0.173, URL/path hooks are thankfully available. I built a solution to overwrite page paths using an input field on pages for the public. If filled, the Page::path hook returns my custom path string, which means URLs etc. are even auto-updated. A second hook checks all incoming requests and delivers the page by matching the defined path/URL. # ready.php // Change page path $wire->addHookBefore('Page::path', function($event) { $page = $event->object; if (!empty($page->page_generic_urlpath)) { $event->replace = true; $event->return = $page->page_generic_urlpath; } }); # ready.php // Route page path back $wire->addHook('/([a-zA-Z0-9-/]+)/', function($event) { $urlpath = '/' . $event->arguments(1) . '/'; $page = $event->pages->findOne('page_generic_urlpath=' . $urlpath . ', include=hidden'); return $page->id && $page->viewable ? $page : $event->return; }); This works fine as long as multilanguage support is not required. However, with multiple languages, it becomes much more complicated. The Page::path hook is useless, and the logic needs to be implemented in LanguageSupportPageNames->getPagePath(), which is not hookable. In short, I can't find a good way to map my multilingual custom paths from an input field to the corresponding localized language paths. I ended up making minimal edits in LanguageSupportPageNames->getPagePath() to replace multilingual paths when necessary. However, I would prefer an elegant solution over a "core module hack". Does anyone have a good idea for changing page language local paths via hooks? In my tests, Page::localPath is neither hookable nor defined with underscores. Changing the deeper internal language logic seems impossible. Or not?! 🙂
    1 point
  4. This week the dev branch core version has been bumped to 3.0.254. Relative to 3.0.253 this version contains 14 commits with around 10 bug fixes and 5 feature additions. The biggest addition is Markup File Regions, which I’ve used literally every day since adding the feature two weeks ago. Fingers crossed, but I haven’t had to fix anything or make any adjustments to it so far, so it’s been very stable and reliable. I’m currently working on a client project (collaborating with Pete, Diogo and Jan P.) and that’s kept me busy the last 2-3 weeks, and likely will for a couple more. So there aren’t likely to be a lot of commits to the core during that time, but I’ll be very ProcessWire focused for sure. Working on projects using ProcessWire (as opposed to just working on ProcessWire) has always been key. But I’ve also been wanting to get the next main/master version out as soon as possible (as I’ve mentioned a couple times recently), so will be trying to do both. Thanks for reading and have a great weekend!
    1 point
  5. @ryan I'd be interested to hear how you work on a project with multiple developers and manage keeping each developer's development instance in-sync. For example, are you using a migrations module like RockMigrations or writing migrations in a module specific to the site that adds/updates fields/templates/pages/settings when the module is updated using a version compare? Or are you doing something completely different? I'd be interested to hear how you handle this given that ProcessWire stores much of its configuration in the database.
    1 point
  6. Sorry about that @Nick Belane - should be fixed in the latest version.
    1 point
  7. Good day, whoever needs this years later) This trick for hook is obsolete after the newly introduces Page::renderPage hook (see here). That is great, but it does break the old way of getting page with the line quoted above. Change the code to something like this: wire()->addHookBefore('Page::renderPage', function (HookEvent $event) { $page = $event->object; ...
    1 point
×
×
  • Create New...