This week we have ProcessWire 3.0.201 on the dev branch which includes a couple minor fixes but also a couple of useful additions:
There are new "Tab" field visibility options available for any field in the page editor. This makes the field display in its own page editor tab. It saves you from having to create a new/separate Tab field just to wrap around an existing field to make it display in a tab. So far I've found it particularly useful with ProFields (Combo, Table, Textareas, RepeaterMatrix) as well as the core Repeater, FieldsetPage and Images fields.
For instance, I have a Combo field labeled "SEO" that lets me edit browser_title, meta_description, canonical_url, etc., and now I can add that field to any template and pages using that template have their own "SEO" tab. Sure you could do this before by creating a separate tab field with an "SEO" label, but now it's a lot simpler/faster, as any field can now display as a tab on its own.
Like with the other visibility modes, also included are options to make the tab load dynamically on click with ajax or make the value non-editable. You can also optionally specify a label for the tab independently of the field label. This is because usually you want tab labels to be very short (1 word is best) whereas field labels have no such need. Please note that this new Tab option is exclusive to the page editor, and in order to work the field must not already be in a tab.
Also added this week is a new $page->getMultiple() method. This method works the same as the $page->get() method except that it lets you retrieve multiple page property/field values at once and returns them in an array. For example:
$a = $page->getMultiple([ 'foo', 'bar', 'baz' ]);
list($foo, $bar, $baz) = $a;
It also accepts a CSV string:
$a = $page->getMultiple('foo,bar,baz');
By default it returns a regular PHP array, suitable for using in list() like the first example. But if you want it to return an associative array instead, then specify true as the 2nd argument:
$a = $page->getMultiple('foo,bar,baz', true);
echo $a['foo'];
echo $a['bar'];
echo $a['baz'];
I find this method useful in reducing the amount of code/lines necessary in many cases, and most often I use it in combination with a PHP list() call, i.e.
list($title,$subtitle,$body) = $page->getMultiple('title,subtitle,body');
That's all for this week. Thanks for reading and have a great weekend!