Skip to content

CallbackCustomForm

GiantQuartz edited this page Apr 21, 2020 · 1 revision

CallbackCustomForm

Example of usage

$form = new CallbackCustomForm(new TranslationContainer("TITLE"));
$form->addElement("example", new Input(new TranslationContainer("INPUT"))); // Adds a element with the id 'example'

// Use CallbackCustomForm->setSubmitListener() to set a callback with a closure that
// will be executed whenever the form is submitted
$form->setSubmitListener(function($_) use ($form) {
   $desc = $form->getElement("example")->getResult(); // The text introduced on the input 'example'
});

// Opens the form to a player
$player->openForm($form);

Clone this wiki locally