Download the PHP package j1b1x/forms without Composer
On this page you can find all versions of the php package j1b1x/forms. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package forms
Forms
This is a PocketMine-MP 5.0 form library with PHP 8.0 support and high quality code
Credits
This API is a spoon of Frago's forms library and also includes a ServerSettingsForm which is inspired of skymin's ServerSettingsForm virion and a FormImagesFix plugin.
Code samples
- Registration
- Auto-back
- What is "auto-back"?
- Toggling it
- Image Fix
- ServerSettingsForm
- ModalForm
- Using ModalForm to represent "yes" / "no" button clicks as
bool
in closure - Short version of ModalForm to confirm any action
- Using ModalForm to represent "yes" / "no" button clicks as
- MenuForm
- Using MenuForm to display buttons with icons from URL and path
- Creating MenuForm from array of strings (i.e. from
string[]
) with modern syntax of matching button clicks - Appending MenuForm with new options to handle different permissions
- CustomForm
- Using CustomForm with strict-typed API
- Using CustomForm with less strict-typed API
- From/to Data CustomForm
- Uncloseable Form
- Sending an uncloseable form
Registration
In order to use the auto-back feature you first need to register the packet handler by doing
Note: You only need to do this if you use this plugin as a virion, otherwise it's handled by the Main class
Auto-back
Auto-back is a feature that sends the previous opened form to the player once they close a form or click on a back button. It also overwrites back buttons in a MenuForm with close buttons if there's no form to go back to If you want to use the auto-back feature, you just need to do
Image fix
Image fix is a workaround for a MCPE MenuForm bug, where url button images take ages to load To make this work you only need to do the registration
ServerSettingsForm
The ServerSettingsForm is similar to a CustomForm and has the same elements, but will be displayed in the player's game-settings ui Once you have registered the packet handler, you can just use the ServerSettingsFormEvent
ModalForm
Using ModalForm to represent "yes" / "no" button clicks as bool
in closure
Short version of ModalForm to confirm any action
MenuForm
Using MenuForm to display buttons with icons from URL and path
Shorther/simpler MenuForm, you can directly set the button's onSubmit callback, which can be useful if you have object foreaches
CustomForm
Using CustomForm with strict-typed API
Using CustomForm with less strict-typed API
Using CustomForms elements with directly setting their onSubmit callback
From/to Data CustomForm. This can be useful if you want to send the same ui again, but with some changes, such as an error message label
Uncloseable form
An uncloseable form can be useful if you permanently want to display something to the player