Jet\Form_Renderer_Form

A Renderer designed to display the beginning and end of the form. Thus, it is a pair renderer inheriting from the Jet\Form_Renderer_Pair class.

Overview of constants

Constants are used to determine widths of elements when creating a responsive page/application design.

Constant Meaning of
Form_Renderer::LJ_SIZE_EXTRA_SMALL Display layout width (user display size) - extra small
Form_Renderer::LJ_SIZE_SMALL Display layout width (user display size) - small
Form_Renderer::LJ_SIZE_MEDIUM Display layout width (user display size) - medium
Form_Renderer::LJ_SIZE_LARGE Display layout width (user display size) - large

Default view scripts

The name of the default view script is start for the beginning of the form and end for the end.

The value in the system configuration can be accessed as follows:

$view_script_start SysConf_Jet_Form_DefaultViews::get('Form''start');
$view_script_end SysConf_Jet_Form_DefaultViews::get('Form''end');
SysConf_Jet_Form_DefaultViews::set('Form''start''my-view-script-start');
SysConf_Jet_Form_DefaultViews::set('Form''end''my-view-script-end');

Overview of methods

Method Meaning of
public __construct(
Form $form
)
The only constructor parameter is the form instance to which the renderer belongs.
public getForm(
) : Form
Returns the form instance to which the renderer belongs.
protected generateTagAttributes_Standard(
) : void
This internal method takes care of generating standard form tag attributes according to its definition.
public message(
) : Form_Renderer_Form_Message
Returns a renderer instance for displaying the general form message.
public setDefaultLabelWidth(
array $default_label_width
) : void
Sets the default width of all form element labels. Of course, it is possible to set extra widths for individual elements afterwards, but setting the width for the whole form is the default setting.

Usage: $form->renderer()->setDefaultLabelWidth( [
    
Form_Renderer::LJ_SIZE_EXTRA_SMALL => 12,
    
Form_Renderer::LJ_SIZE_MEDIUM => 2,
] );
It is advisable to call the method in the view script that displays the form.
public getDefaultLabelWidth(
) : array
Returns the default width of all form element labels. See the setDefaultLabelWidth method.
public setDefaultFieldWidth(
array $default_field_width
) : void
Sets the default widths of the input fields of all form elements. Of course, it is possible to set extra widths for individual elements afterwards, but setting the width for the whole form is the default setting.

Usage: $form->renderer()->setDefaultFieldWidth( [
    
Form_Renderer::LJ_SIZE_EXTRA_SMALL => 12,
    
Form_Renderer::LJ_SIZE_MEDIUM => 10,
] );
The method should be called in the view script that displays the form.
public getDefaultFieldWidth(
) : array
Returns the default width of the input fields of all form elements. See the setDefaultFieldWidth method.
Previous chapter
Jet\Form_Renderer_Pair
Next chapter
Jet\Form_Renderer_Form_Message