/** Datei: plugins/rest/library/ARUNOX/Plugins/REST/Generator/Data/Form/Helpers/GroupHelpers.php **/ * @copyright 2025 ARUNOX * @version 1.0.0 * @since 1.0.0 File is created */ namespace ARUNOX\Plugins\REST\Generator\Data\Form\Helpers; use ARUNOX\Plugins\REST\Generator\Data\Form\Group; trait GroupHelpers { /* ### TRAIT INIT FUNCTIONS ##################################### # */ public function GroupHelpersInit() { $this->addAllowedContent( "group", [ "generator" => Group::class, "args" => [], ]); } /* ### PUBLIC FUNCTIONS ######################################### # */ public function addGroup( ...$args ) { $this->add( "group", ...$args ); return isset( $args[1] ) ? $this : end( $this->content ); } } /** Datei: plugins/rest/library/ARUNOX/Plugins/REST/Generator/Data/Form/Helpers/ControlHelpers.php **/ * @copyright 2025 ARUNOX * @version 1.0.0 * @since 1.0.0 File is created */ namespace ARUNOX\Plugins\REST\Generator\Data\Form\Helpers; use ARUNOX\Plugins\REST\Generator; use ARUNOX\Plugins\REST\Generator\Data\Form\Control; trait ControlHelpers { /* ### TRAIT INIT FUNCTIONS ##################################### # */ public function ControlHelpersInit() { $this->addAllowedContent( "field", [ "generator" => Control::class, "args" => [], ]); } /* ### PUBLIC FUNCTIONS ######################################### # */ public function addField( ...$args ) { if( isset( $args["type"] ) ) { $class = "ARUNOX\\Plugins\\REST\\Generator\\Data\\Form\\Control\\" . $args["type"]->name; } if( class_exists( $class ) ) { $field = Generator::create( $class, ...$args ); $this->add( "field", $field ); } else $this->add( "field", ...$args ); return $this; } public function addFields( ...$args ) { foreach( $args as $arg ) { $this->addField( ...$arg ); } } }