On the dev branch this week are a few issue fixes, but also some new features. The "Parent" field in the page editor (Settings tab) now is contextual to the page's template family settings. Now it will just show you the allowed parents, if you've configured them in the template. Previously it would show you a page tree to select from anywhere in the site. This saves you time, as well as the hassle of getting an error message after save, should you select a parent that isn't allowed by the page's template family settings.
Next, the page tree "Move" actions (that you see when hovering a page in the tree) are now a little smarter. Previously, these Move actions would appear for any page that was either sortable or moveable. But now it also checks how many other allowed parents there are, per template family settings. If there aren't yet any other potential parent pages existing in the site, the page is no longer considered moveable, and thus won't show a Move action. This useful addition was added per Bernhard's request, as was the addition to a couple new classes used in the page tree to better differentiate between public vs non-public pages... something that I understand Bernhard's admin style may soon demonstrate.
This week a question came up through email about how to make multi-language "required" fields require a value in all languages the page is active in. Currently multi-language required fields only require a value to be present in the default language. If you want to make them require all active languages, you can do so with a hook in /site/ready.php. I thought it was pretty useful so thought I'd share it here. Though maybe we'll have to add it as a feature.
if($page->process == 'ProcessPageEdit') {
$wire->addHookAfter('Inputfield(required=1,useLanguages=1)::processInput', function($event) {
$inputfield = $event->object;
$page = $inputfield->hasPage;
if(!$page) return;
foreach($event->wire()->languages as $language) {
if($language->isDefault()) continue;
if(!$page->get("status$language")) continue; // skip languages not active on page
$value = $inputfield->get("value$language");
if(empty($value)) {
$inputfield->error("Value required for language " . $language->get('title|name'));
}
}
});
}