Skip to content

Output The GUI

Josh 'VaMoose' harington edited this page Dec 1, 2016 · 1 revision

The GUI

We have provided two ways of getting a GUI. Either a form or a list. I will take you through how to add more as well.

Form

To create a form element, we need to start by creating the factory.


$factory = new GUIFactory(new AdapterFactory);

Now we need to specify which type of view we would like to use. For form, we need to use the GUIEnum::FORM constant.


$gui = $factory->make(GUIEnum::FORM);

And finally, we need to return the view with the following line of code:


return $gui->render($data);

So all in all, to create a form, we have:


$factory = new GUIFactory(new AdapterFactory);
$gui = $factory->make(GUIEnum::FORM);

return $gui->render($data);

List

We use the exact same code as above, except now, we will use the GUIEnum::UILIST constant.

Note: we use the name UILIST and not LIST because LIST is a used keyword.


$factory = new GUIFactory(new AdapterFactory);
$gui = $factory->make(GUIEnum::UILIST);

return $gui->render($data);

Clone this wiki locally