Allow to specify which label profiles are shown in dropdown.

This commit is contained in:
Jan Böhmer 2020-05-02 19:47:31 +02:00
parent 3804e2534d
commit 8b372a3443
8 changed files with 64 additions and 80 deletions

View file

@ -36,8 +36,10 @@ class LabelProfileRepository extends NamedDBElementRepository
*/
public function getDropdownProfiles(string $type): array
{
//TODO: Improve this, when we have a 'showInDropdown' flag for profiles.
return $this->findForSupportedElement($type);
if (!in_array($type, LabelOptions::SUPPORTED_ELEMENTS)) {
throw new \InvalidArgumentException('Invalid supported_element type given.');
}
return $this->findBy(['options.supported_element' => $type, 'show_in_dropdown' => true], ['name' => 'ASC']);
}
/**