Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/06/2021 in all areas

  1. I had some fun too. Created another theme/style based on default reno style but tried to add more contrast (WCAG AA). It's also more in blue tones (but I kept PW pinky color) to match our website color theme. There are also some other tweaks. admin.less
    2 points
  2. 1.1.0 released with support for formatting text outside of the field context. You can now use the following to format arbitrary text: print $modules->get('TextformatterTypographer')->formatString($text); Note that this new method does not use by-reference passing of the input text.
    2 points
  3. (once again I was surprised to see a work of mine pop up in the newsletter, this time without even listing the module on PW modules website ?. Thx @teppo !) FieldtypeQRCode Github: https://github.com/eprcstudio/FieldtypeQRCode Modules directory: https://processwire.com/modules/fieldtype-qrcode/ A simple fieldtype generating a QR Code from the public URL of the page, and more. Using the PHP library QR Code Generator by Kazuhiko Arase. Options In the field’s Details tab you can change between .gif or .svg formats. If you select .svg you will have the option to directly output the markup instead of a base64 image. SVG is the default. You can also change what is used to generate the QR code and even have several sources. The accepted sources (separated by a comma) are: httpUrl, editUrl, or the name of any text/URL/file/image field. If LanguageSupport is installed the compatible sources (httpUrl, text field, ...) will return as many QR codes as there are languages. Note however that when outputting on the front-end, only the languages visible to the user will be generated. Formatting Unformatted value When using $page->getUnformatted("qrcode_field") it returns an array with the following structure: [ [ "label" => string, // label used in the admin "qr" => string, // the qrcode image "raw" => string, // the raw qrcode image (in base64, except if svg+markup) "source" => string, // the source, as defined in the configuration "text" => string // and the text used to generate the qrcode ], ... ] Formatted value The formatted value is an <img>/<svg> (or several right next to each other). There is no other markup. Should you need the same markup as in the admin you could use: $field = $fields->get("qrcode_field"); $field->type->markupValue($page, $field, $page->getUnformatted("qrcode_field")); But it’s a bit cumbersome, plus you need to import the FieldtypeQRCode's css/js. Best is to make your own markup using the unformatted value. Static QR code generator You can call FieldtypeQRCode::generateQRCode to generate any QR code you want. Its arguments are: string $text bool $svg Generate the QR code as svg instead of gif ? (default=true) bool $markup If svg, output its markup instead of a base64 ? (default=false) Hooks Please have a look at the source code for more details about the hookable functions. Examples $wire->addHookAfter("FieldtypeQRCode::getQRText", function($event) { $page = $event->arguments("page"); $event->return = $page->title; // or could be: $event->return = "Your custom text"; }) $wire->addHookAfter("FieldtypeQRCode::generateQRCodes", function($event) { $qrcodes = $event->return; // keep everything except the QR codes generated from editUrl foreach($qrcodes as $key => &$qrcode) { if($qrcode["source"] === "editUrl") { unset($qrcodes[$key]); } } unset($qrcode); $event->return = $qrcodes; })
    1 point
  4. I noticed that there is an option to "Open Home/View site in new tab (topnav)", and i have that checked. But when i select the menu item called "View Site" in the top nav, it doesn't open in a new window. So i wanted to report that as a possible bug. This is on UIKit admin theme. Also it would be cool if we could have an option for view links on the page list open in a new tab, if that isn't already an option somewhere that i missed...
    1 point
  5. @ryan - what about a dedicated "Skins" section - maybe within the modules directory. Perhaps the requirement for adding a skin to the directory would be to link to a Github repo with the admin.less and also an admin.png file which could be used on the skin's page in the directory. Ideally I think it would be nice if it was possible to view all skin screenshots via a gallery of thumbnails to make it easy to browse visually.
    1 point
  6. Thank you so much for your quick response, @Mike Rockett! Long-time developer here, but very very new to ProcessWire. I’d suspected I was calling the module in the wrong way — and clearly I was right! So, thank you for adding the new method, but in fact I’ll look into configuring the field to use it as a formatter; I’ll bet that’ll be more efficient in terms of caching (and using a reference!) than what I was trying to do! I’m loving ProcessWire, but there’s a lot to learn....
    1 point
  7. @ErikMH – Hi Erik, The module wasn't intended to be used manually like that. Normally, you would apply the module as a formatter for the field in question by modifying the field's configuration. Under the hood, the formatValue method is called, which imports the vendor packages and runs the formatter. I guess if you wanted to, you could call this method manually, but you would need to pass in an instance of the current page and field. Here is the method signature that it uses: public function formatValue(Page $page, Field $field, &$value); The value is passed in by reference. I guess I can see that there might be use-cases for calling the method outside of the PW field system, so I reckon I should add a method to format arbitrary strings without the page and field dependencies (which are not used anyway - it's just the method signature that PW uses for formatters).
    1 point
  8. I made a small update where you can now output the QR Code on the front-end by calling the field directly (instead of rendering the inputfield) and I added the option to output the image in either .svg or .gif (if .svg, you'll have the additional ability to output the markup directly, instead of a base64).
    1 point
  9. The next dev version of ProcessWire is in progress but I'll wait till likely next week to bump the version. So far there are 6 new pull requests added since 3.0.179 and 2 issue resolutions, plus some other updates, with plenty more on the way. A lot of focus this week has also been on FormBuilder updates which include new spam filtering options, improved save-to-page options, improved Combo field support, new entries actions (and the ability to add more via modules and hooks), framework updates, and various minor bug fixes. This version has a lot of nice improvements and I'm hoping to have it ready for you in the next week or so. More details soon. Have a great weekend!
    1 point
  10. Hi Phillip – I'm so incredibly sorry for neglecting this. I noted in the merge requests that I'd get to it, and then never did. I'm going to go ahead and accept both and release, however I have no reliable way to test without configuring dev-environments for it. So if there are any issues, we can deal with them on an as-and-when-needed basis. Edit: Managed to test. Very strange. Seems like something that would need to be fixed in the underlying package. Updating to v6.6 now as part of the above merge request at least. ?
    1 point
×
×
  • Create New...