This week we take a look at a new rich text editor for ProcessWire, why we chose it, some highlights, screenshots, and why we think you’ll like it. More
140 commits, 55 resolved issues, dozens of new features, eight contributors, and five new pull requests make yet another great new version of ProcessWire.
This week I’m happy to announce another new main/master branch version of ProcessWire, version 3.0.210. Like most main release versions, there is a lot here. This post covers some of the most notable additions and improvements.
Updated the login form (ProcessLogin) to auto-refresh every 5 minutes of non-activity. This helps to avoid cases where a login form sits for a long period and has its CSRF key expire. It can prevent this error message, which you might have seen before:
“This request was aborted because it appears to be forged.” —Your friend, ProcessWire
Updated ProcessTemplate module so that when you add one (1) new template, it now goes straight to edit the template, rather than back to the template list.
Added support for remembering language tabs focus between requests after a “change all” double-click language tab, via PR from FlipZoomMedia.
Added new page editor Inputfield visibility mode “Tab” which makes any Inputfield display as a page editor tab. The tab options include: 'Tab', 'Tab (AJAX)', and 'Tab (locked)'.
Added new “Usage” fieldset/info on Field edit page primary tab. This shows what templates use the field being edited. While this information is also available in Actions, this addition adds consistency with the Usage info on templates.
Added a memory limit check to ProcessWire’s installer.
Added a new $page->getMultiple($keys); method where
$keys can be array or CSV string of properties/fields to return in an array.
$values = $page->getMultiple([ 'title', 'summary' ]);
$values = $page->getMultiple('title,summary'); // same as above
The above returns a regular PHP array (non-associative) by default, specify true as the 2nd argument to get an associative array indexed by given key names:
$values = $page->getMultiple('title,subtitle,body', true);
$page->get() method improvements, including full support of dot syntax (regardless of output formatting state)…
$value = $page->get('field_name.subfield_name.title');
…and support for
brackets to force multi-value, returning array or WireArray (according to type) even on single-value fields…
$values = $page->get('field_name');
…and the ability to specify indexes to get a single item from a multi-value field, like the first item (index 0) in this example below…
$firstValue = $page->get('field_name');
…and bracketed selectors to filter the multi-value field as you get it…
$values = $page->get('some_multi_value_field[title%=design]');
…and the ability to combine any of these.
Added support for a
$page->getPageListLabel(); method which enables custom page classes to return custom markup for the page's label in the page-list.
Updated PagesPathFinder to provide 301 redirect for paths ending with
/index.php, rather than responding with a 404 code.
Added support for returning template property values (i.e.
template.name, etc.) in $pages->findRaw().
renderFlags option letting you specify that a given Inputfield should render at the top or bottom of its siblings, regardless of its position (like a sticky attribute).
New methods to support adding classes to different elements (wrap, header, content, input) in one call via a string (see addClass() method for details).
Updated inputfields.js for better error handling and improved field reloading support.
Update InputfieldWrapper class to have an error method named getErrorInputfields() that enables you to get Inputfields having errors rather than just getting error messages.
These are technically both admin-related improvements and API-related improvements.
Now you can include separate label and notice text by calling message/warning/error like this:
$this->message([ 'Notice label' => 'Notice text' ]);
New support for a Notice::allowDuplicate flag which allows duplicate notices to appear when rendered. To use, specify it in the flags argument:
$this->message('notice text', 'duplicate'); // this
$this->message('notice text', Notice::duplicate); // or this
Improved debugging output when passed object or array values for message text.
The Notice icon can now be specified in the notice flags, if using a flags string, i.e.
$this->message('notice text', 'icon-eye-slash');
These can be combined with other flags too of course, i.e.
$this->message('notice text', 'markdown duplicate icon-home');
Comments system improvements
New additions to ProcessCommentsManager module including a new separate dedicated comment editor and the ability to add new comments or replies from within the module.
InputfieldCommentsAdmin was upgraded with an option to link to the comments manager rather than making comments editable in the page editor (see "Input" tab for that config option). This is especially useful in cases where there may be more comments present than is manageable in the page editor.
Added new allowChildren() method to Comment class indicating whether or not replies are allowed to the comment.
Updated comments.js to allow for de-selection of stars in cases where a user might accidentally click on a stars input and want to revert to no-selection.
Other API improvements
Added support for
$items = $item; append syntax to WireArray/PageArray. This enables you to add items to a WireArray or PageArray similar to how you would with a regular PHP array.
$items = WireArray();
$items = $item1;
$items = $item2;
$items = $item3;
Updated the $templates->delete($template) method to also delete fieldgroup having the same name as the template (when that fieldgroup is not used elsewhere).
$hookable option to the wireMethodExists() function, enabling it to detect cases where the method may exist in a
Updated the $sanitizer->email() method to add IDN, UTF-8, ASCII, and DNS support options.
Added a Debug::toStr() method for dumping any variable to a string (for debugging purposes)
Added new FieldtypeHasPagefiles and FieldtypeHasPageimages interfaces and update FieldtypeFile/Image to support them. These interfaces enable a Fieldtype to communicate that it manages Pagefile/Pageimage objects and provides a method for retrieving them.
A big thanks to our growing list of contributors. Above is just a list of notable features and improvements added in this version. But this version includes a lot more than that. We didn't cover the numerous individual issue resolutions and other minor improvements and optimizations (and there were a lot of them).
Also worth noting is that the development of InputfieldTinyMCE is perhaps one of the biggest recent additions in ProcessWire, but is not part of this core version. It will be merged into the dev branch shortly and be part of the next main/master release after this. So this is likely the last tagged release that will be CKEditor exclusive, while following versions will include both TinyMCE and CKEditor. Some time after CKEditor 4.x is officially EOL it will be moved out of the core and maintained in the modules directory.
Thanks for reading! We hope you enjoy this new version, please let us know it works for you. For more ProcessWire news and updates be sure to read the ProcessWire Weekly.
Post a comment
The TinyMCE 6 rich text editor opens up a lot of new and useful abilities for ProcessWire users. In this post, we'll take a look at a few of them, and how you can start using them now, with a focus on those that are unique to ProcessWire's adaptation of TinyMCE. More