From: Marcel Werk Date: Sun, 19 Jul 2020 15:27:51 +0000 (+0200) Subject: Fixed issue when editing articles without tags X-Git-Tag: 5.3.0_Alpha_1~127 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=26a10c5d50a655121eb20676a7b9d5b379283668;p=GitHub%2FWoltLab%2FWCF.git Fixed issue when editing articles without tags --- diff --git a/com.woltlab.wcf/templates/articleAdd.tpl b/com.woltlab.wcf/templates/articleAdd.tpl index 2098e7b0c6..9ba2864b79 100644 --- a/com.woltlab.wcf/templates/articleAdd.tpl +++ b/com.woltlab.wcf/templates/articleAdd.tpl @@ -303,11 +303,7 @@ {if MODULE_TAGGING} - {if !$tags[0]|empty} - {include file='tagInput' tagInputSuffix='0' tagSubmitFieldName='tags[0][]' tags=$tags[0] sandbox=true} - {else} - {include file='tagInput' tagInputSuffix='0' tagSubmitFieldName='tags[0][]' sandbox=true} - {/if} + {include file='tagInput' tagInputSuffix='0' tagSubmitFieldName='tags[0][]' tags=$tags[0] sandbox=true} {/if} {event name='informationFields'} @@ -434,11 +430,7 @@ {if MODULE_TAGGING} {assign var='tagSubmitFieldName' value='tags['|concat:$availableLanguage->languageID:'][]'} - {if !$tags[$availableLanguage->languageID]|empty} - {include file='tagInput' tagInputSuffix=$availableLanguage->languageID tagSubmitFieldName=$tagSubmitFieldName tags=$tags[$availableLanguage->languageID] sandbox=true} - {else} - {include file='tagInput' tagInputSuffix=$availableLanguage->languageID tagSubmitFieldName=$tagSubmitFieldName sandbox=true} - {/if} + {include file='tagInput' tagInputSuffix=$availableLanguage->languageID tagSubmitFieldName=$tagSubmitFieldName tags=$tags[$availableLanguage->languageID] sandbox=true} {/if} {event name='informationFieldsMultilingual'} diff --git a/wcfsetup/install/files/acp/templates/articleAdd.tpl b/wcfsetup/install/files/acp/templates/articleAdd.tpl index 2098e7b0c6..9ba2864b79 100644 --- a/wcfsetup/install/files/acp/templates/articleAdd.tpl +++ b/wcfsetup/install/files/acp/templates/articleAdd.tpl @@ -303,11 +303,7 @@ {if MODULE_TAGGING} - {if !$tags[0]|empty} - {include file='tagInput' tagInputSuffix='0' tagSubmitFieldName='tags[0][]' tags=$tags[0] sandbox=true} - {else} - {include file='tagInput' tagInputSuffix='0' tagSubmitFieldName='tags[0][]' sandbox=true} - {/if} + {include file='tagInput' tagInputSuffix='0' tagSubmitFieldName='tags[0][]' tags=$tags[0] sandbox=true} {/if} {event name='informationFields'} @@ -434,11 +430,7 @@ {if MODULE_TAGGING} {assign var='tagSubmitFieldName' value='tags['|concat:$availableLanguage->languageID:'][]'} - {if !$tags[$availableLanguage->languageID]|empty} - {include file='tagInput' tagInputSuffix=$availableLanguage->languageID tagSubmitFieldName=$tagSubmitFieldName tags=$tags[$availableLanguage->languageID] sandbox=true} - {else} - {include file='tagInput' tagInputSuffix=$availableLanguage->languageID tagSubmitFieldName=$tagSubmitFieldName sandbox=true} - {/if} + {include file='tagInput' tagInputSuffix=$availableLanguage->languageID tagSubmitFieldName=$tagSubmitFieldName tags=$tags[$availableLanguage->languageID] sandbox=true} {/if} {event name='informationFieldsMultilingual'} diff --git a/wcfsetup/install/files/lib/acp/form/ArticleAddForm.class.php b/wcfsetup/install/files/lib/acp/form/ArticleAddForm.class.php index ac1f7dc991..65c7aa9e92 100644 --- a/wcfsetup/install/files/lib/acp/form/ArticleAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/ArticleAddForm.class.php @@ -478,6 +478,16 @@ class ArticleAddForm extends AbstractForm { if (empty($_POST)) { $this->setDefaultValues(); } + + // init tags + if (!$this->isMultilingual) { + if (!isset($this->tags[0])) $this->tags[0] = []; + } + else { + foreach ($this->availableLanguages as $language) { + if (!isset($this->tags[$language->languageID])) $this->tags[$language->languageID] = []; + } + } } /**