1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-10 16:54:44 +02:00

Fix issue where language on/off checkbox in ProcessPageAdd wasn't always mirring parent page language on/off status for initial/recommended setting

This commit is contained in:
Ryan Cramer
2021-02-26 14:00:08 -05:00
parent 49b9932ab6
commit 8020803b7d
3 changed files with 8 additions and 6 deletions

View File

@@ -200,9 +200,11 @@ class InputfieldPageName extends InputfieldName implements ConfigurableModule {
$name = $sanitizer->entities($this->checkboxName);
$value = $sanitizer->entities($this->checkboxValue);
$label = $sanitizer->entities($this->checkboxLabel);
$adminTheme = $this->wire()->adminTheme;
$checkboxClass = $adminTheme ? $adminTheme->getClass('input-checkbox') : '';
$box =
"<label class='checkbox detail'>" .
"<input type='checkbox' name='$name{$this->checkboxSuffix}' value='$value'$checked$disabled /> $label" .
"<input type='checkbox' class='$checkboxClass' name='$name{$this->checkboxSuffix}' value='$value'$checked$disabled /> $label" .
"</label>";
}

View File

@@ -521,7 +521,11 @@ class LanguageSupportPageNames extends WireData implements Module, ConfigurableM
$inputfield->checkboxName = "status" . $language->id;
$inputfield->checkboxValue = 1;
$inputfield->checkboxLabel = $checkboxLabel;
if($page->id > 0) $inputfield->checkboxChecked = $page->get($inputfield->checkboxName) > 0;
if($page->id > 0) {
$inputfield->checkboxChecked = $page->get($inputfield->checkboxName) > 0;
} else if($inputfield->parentPage) {
$inputfield->checkboxChecked = $inputfield->parentPage->get($inputfield->checkboxName) > 0;
}
if(!$editable) $inputfield->attr('disabled', 'disabled');
$out .= $inputfield->render();
}

View File

@@ -835,10 +835,6 @@ class ProcessPageAdd extends Process implements ConfigurableModule, WirePageEdit
/** @var Languages $languages */
if($languages && $this->parent && $this->parent_id > 0) {
foreach($languages as $language) {
if($language->isDefault()) continue;
$field->checkboxChecked = $this->parent->get("status$language") ? true : false;
}
if($this->template) {
// dummy edit page for examination by InputfieldPageName
$editPage = $this->wire('pages')->newPage(array(