Skip to content

Commit

Permalink
little code correction
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanashi committed Oct 17, 2024
1 parent e7c6850 commit 358995f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 deletions.
4 changes: 2 additions & 2 deletions files/lib/acp/form/FaqCategoryAddForm.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ protected function createForm()
#[Override]
protected function finalizeForm()
{
parent::finalizeForm();

$this->form->getDataHandler()->addProcessor(
new CustomFormDataProcessor(
'icon',
Expand All @@ -57,7 +59,5 @@ function (IFormDocument $document, array $data, IStorableObject $object) {
}
)
);

parent::finalizeForm();
}
}
9 changes: 2 additions & 7 deletions files/lib/acp/form/FaqQuestionAddForm.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@ class FaqQuestionAddForm extends AbstractFormBuilderForm
*/
public $activeMenuItem = 'wcf.acp.menu.link.faq.questions.add';

/**
* @inheritDoc
*/
public $formAction = 'create';

/**
* @inheritDoc
*/
Expand Down Expand Up @@ -191,9 +186,9 @@ protected function createForm()
}

#[Override]
public function buildForm()
public function finalizeForm()
{
parent::buildForm();
parent::finalizeForm();

$this->form->getDataHandler()->addProcessor(new CustomFormDataProcessor(
'answer_i18n',
Expand Down
27 changes: 17 additions & 10 deletions files/lib/acp/form/FaqQuestionEditForm.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,25 @@ public function readParameters()
if (!$this->formObject->questionID) {
throw new IllegalLinkException();
}
if ($this->formObject->isMultilingual) {
$this->isMultilingual = 1;

$languageItemList = new LanguageItemList();
$languageItemList->getConditionBuilder()->add('languageItem = ?', [$this->formObject->answer]);
$languageItemList->readObjects();
foreach ($languageItemList as $languageItem) {
$this->multiLingualAnswers[$languageItem->languageID] = $languageItem->languageItemValue;
}
}
} catch (MappingError) {
throw new IllegalLinkException();
}
}

#[Override]
public function readData()
{
parent::readData();

if ($this->formObject->isMultilingual) {
$this->isMultilingual = 1;

$languageItemList = new LanguageItemList();
$languageItemList->getConditionBuilder()->add('languageItem = ?', [$this->formObject->answer]);
$languageItemList->readObjects();
foreach ($languageItemList as $languageItem) {
$this->multiLingualAnswers[$languageItem->languageID] = $languageItem->languageItemValue;
}
}
}
}

0 comments on commit 358995f

Please sign in to comment.