Elgg  Version 7.1
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Elgg\FormsService Class Reference

Forms service. More...

Public Member Functions

 __construct (protected ViewsService $views, protected EventsService $events, protected ESMService $esm, protected FieldsService $fields,)
 Constructor. More...
 
 render (string $action, array $form_vars=[], array $body_vars=[])
 
 renderEntity (string $entity_type, string $entity_subtype, ?\ElggEntity $entity=null, array $vars=[])
 Render an entity edit/add form. More...
 
 setFooter (string $footer='')
 Sets form footer and defers its rendering until the form view and extensions have been rendered. More...
 
 getFooter ()
 Returns currently set footer. More...
 

Protected Member Functions

 getFormView (string $entity_type, string $entity_subtype)
 Get the form view for edit/add of an entity type/subtype. More...
 
 getFormAction (string $entity_type, string $entity_subtype)
 Get the form action for edit/add of an entity type/subtype. More...
 

Protected Attributes

bool $rendering = false
 
string $footer = ''
 

Detailed Description

Forms service.

Definition at line 18 of file FormsService.php.

Constructor & Destructor Documentation

◆ __construct()

Elgg\FormsService::__construct ( protected ViewsService  $views,
protected EventsService  $events,
protected ESMService  $esm,
protected FieldsService  $fields 
)

Constructor.

Parameters
ViewsService$viewsViews service
EventsService$eventsEvents service
ESMService$esmESM service
FieldsService$fieldsFields service

Definition at line 34 of file FormsService.php.

Member Function Documentation

◆ getFooter()

Elgg\FormsService::getFooter ( )

Returns currently set footer.

Returns
string
Exceptions
LogicException

Definition at line 267 of file FormsService.php.

◆ getFormAction()

Elgg\FormsService::getFormAction ( string  $entity_type,
string  $entity_subtype 
)
protected

Get the form action for edit/add of an entity type/subtype.

Parameters
string$entity_typeentity type
string$entity_subtypeentity subtype
Returns
string
Exceptions
DomainException
Since
7.1

Definition at line 228 of file FormsService.php.

◆ getFormView()

Elgg\FormsService::getFormView ( string  $entity_type,
string  $entity_subtype 
)
protected

Get the form view for edit/add of an entity type/subtype.

Parameters
string$entity_typeentity type
string$entity_subtypeentity subtype
Returns
string
Since
7.1

Definition at line 203 of file FormsService.php.

◆ render()

Elgg\FormsService::render ( string  $action,
array  $form_vars = [],
array  $body_vars = [] 
)

Definition at line 77 of file FormsService.php.

◆ renderEntity()

Elgg\FormsService::renderEntity ( string  $entity_type,
string  $entity_subtype,
?\ElggEntity  $entity = null,
array  $vars = [] 
)

Render an entity edit/add form.

Parameters
string$entity_typeentity type
string$entity_subtypeentity subtype
\ElggEntity | null$entityentity
array$varsAdditional vars:
  • (string) action: which form action to use
  • (array) body_vars: additional body vars
  • (array) form_vars: additional form vars
  • (string) view: which form view to use
Returns
string
Exceptions
InvalidArgumentException
Since
7.1

Definition at line 162 of file FormsService.php.

◆ setFooter()

Elgg\FormsService::setFooter ( string  $footer = '')

Sets form footer and defers its rendering until the form view and extensions have been rendered.

Deferring footer rendering allows plugins to extend the form view while maintaining logical DOM structure. Footer will be rendered using 'elements/forms/footer' view after form body has finished rendering

Parameters
string$footerFooter
Returns
void
Exceptions
LogicException

Definition at line 253 of file FormsService.php.

Member Data Documentation

◆ $footer

string Elgg\FormsService::$footer = ''
protected

Definition at line 24 of file FormsService.php.

◆ $rendering

bool Elgg\FormsService::$rendering = false
protected

Definition at line 22 of file FormsService.php.


The documentation for this class was generated from the following file: