Use foreach function! example: PHP: foreach(configgetcontents() as $data) { $form->addButton($data->getName());} This is just like a pseudocode so it will not work of course
Take a look at what I found online! https://github.com/DaPigGuy/PiggyCu...ts/commands/CustomEnchantsCommand.php#L33-L34