1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-24 07:13:08 +02:00
This commit is contained in:
Ryan Cramer
2021-08-25 07:37:19 -04:00
parent 9ba7844a5d
commit 212406b173

View File

@@ -3,7 +3,7 @@
/**
* Multi-language support fields module
*
* ProcessWire 3.x, Copyright 2016 by Ryan Cramer
* ProcessWire 3.x, Copyright 2021 by Ryan Cramer
* https://processwire.com
*
* @method void languageAdded(Page $language) #pw-hooker
@@ -22,7 +22,7 @@ class LanguageSupportFields extends WireData implements Module {
static public function getModuleInfo() {
return array(
'title' => 'Languages Support - Fields',
'version' => 100,
'version' => 101,
'summary' => 'Required to use multi-language fields.',
'author' => 'Ryan Cramer',
'autoload' => true,
@@ -133,6 +133,7 @@ class LanguageSupportFields extends WireData implements Module {
*/
public function hookFieldtypeFormatValue(HookEvent $event) {
/** @var Field $field */
$field = $event->arguments[1];
if($field->name == 'language') return;
@@ -156,7 +157,7 @@ class LanguageSupportFields extends WireData implements Module {
// if the page doesn't have a populated language-specific field, then exit
// this will make it fallback to the default language value
if(empty($value)) return;
if($field->type->isEmptyValue($field, $value)) return;
if(is_object($value)) {
if($value instanceof WireArray && !$value->count()) return;
if($value instanceof NullPage) return;