1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-10 16:54:44 +02:00
This commit is contained in:
Ryan Cramer
2017-12-21 09:36:17 -05:00
parent 87dc586c8c
commit 5b53a41c12
2 changed files with 5 additions and 3 deletions

View File

@@ -909,7 +909,7 @@ class Page extends WireData implements \Countable, WireMatchable {
// if the page is currently loading from the database, we assume that any set values are 'raw' and need to be woken up
if(!$this->isLoaded) {
// queue for wakeup and sanitize on first field access
$this->wakeupNameQueue[$field->name] = $field->name;
$this->wakeupNameQueue[$key] = $key;
// page is currently loading, so we don't need to continue any further
return parent::set($key, $value);
}

View File

@@ -37,14 +37,16 @@ class FieldtypeTextLanguage extends FieldtypeText implements FieldtypeLanguageIn
// great, already what we wanted
} else {
// convert it to a LanguagesPageFieldValue
$pageValue = $page->getUnformatted($field->name);
$pageValue = $page->data($field->name); // raw unformatted value, with no load possible
if(!$pageValue instanceof LanguagesPageFieldValue) {
$pageValue = new LanguagesPageFieldValue($page, $field, $pageValue); // #98
}
if(is_array($value)) {
$pageValue->importArray($value);
} else {
$pageValue->setLanguageValue($this->wire('user')->language->id, (string) $value);
$user = $this->wire('user');
$language = $user ? $user->language : null;
if($language) $pageValue->setLanguageValue($language->id, (string) $value);
}
$value = $pageValue;
}