Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ protected function getOptionTypeFormField(): SelectFormField
/**
* @return array<int, string>
*/
private function getContactOptions(): array
protected function getContactOptions(): array
{
$optionList = new ContactOptionList();
$optionList->sqlOrderBy = 'showOrder ASC';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,14 @@ public function assignVariables()
),
]);
}

#[\Override]
protected function getContactOptions(): array
{
return \array_filter(
parent::getContactOptions(),
fn(int $key) => $key !== $this->formObject->getObjectID(),
\ARRAY_FILTER_USE_KEY
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ protected function createForm()
/**
* @return array<int, string>
*/
private function getContactRecipient(): array
protected function getContactRecipient(): array
{
$recipientList = new ContactRecipientList();
$recipientList->sqlOrderBy = 'showOrder ASC';
$recipientList->readObjects();

return \array_map(static fn ($recipient) => $recipient->getName(), $recipientList->getObjects());
return \array_map(static fn($recipient) => $recipient->getName(), $recipientList->getObjects());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,14 @@ public function assignVariables()
),
]);
}

#[\Override]
protected function getContactRecipient(): array
{
return \array_filter(
parent::getContactRecipient(),
fn(int $key) => $key !== $this->formObject->getObjectID(),
\ARRAY_FILTER_USE_KEY
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ protected function createForm()
->languageItemPattern('wcf.reactionType.title\d+'),
ShowOrderFormField::create()
->required()
->options(new ReactionTypeList()),
->options($this->getReactionTypes()),
BooleanFormField::create('isAssignable')
->label('wcf.acp.reactionType.isAssignable')
->description('wcf.acp.reactionType.isAssignable.description')
Expand All @@ -94,4 +94,15 @@ protected function createForm()
$iconContainer,
]);
}

/**
* @return array<int, string>
*/
protected function getReactionTypes(): array
{
$list = new ReactionTypeList();
$list->readObjects();

return \array_map(static fn($option) => $option->getTitle(), $list->getObjects());
}
}
12 changes: 12 additions & 0 deletions wcfsetup/install/files/lib/acp/form/ReactionTypeEditForm.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,16 @@ public function assignVariables()
),
]);
}

/**
* @return array<int, string>
*/
protected function getReactionTypes(): array
{
return \array_filter(
parent::getReactionTypes(),
fn(int $key) => $key !== $this->formObject->getObjectID(),
\ARRAY_FILTER_USE_KEY
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,7 @@ protected function createForm()
->i18nRequired()
->languageItemPattern('wcf.user.option.category.(category\d+|[\w\.]+)'),
ShowOrderFormField::create()
->options(function () {
$categoryList = new UserOptionCategoryList();
$categoryList->getConditionBuilder()->add('parentCategoryName = ?', ['profile']);
$categoryList->readObjects();
$categories = [];

foreach ($categoryList->getObjects() as $category) {
$categories[$category->categoryID] = $category->getTitle();
}

return $categories;
}),
->options($this->getCategories()),
]),
]);
}
Expand Down Expand Up @@ -132,4 +121,19 @@ public function saved()

parent::saved();
}

/**
* @return array<int, string>
*/
protected function getCategories(): array
{
$categoryList = new UserOptionCategoryList();
$categoryList->getConditionBuilder()->add('parentCategoryName = ?', ['profile']);
$categoryList->readObjects();

return \array_map(
static fn($category) => $category->getTitle(),
$categoryList->getObjects()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,14 @@ public function saved()

AbstractFormBuilderForm::saved();
}

#[\Override]
protected function getCategories(): array
{
return \array_filter(
parent::getCategories(),
fn(int $key) => $key !== $this->formObject->getObjectID(),
\ARRAY_FILTER_USE_KEY
);
}
}