Framework  3.9
AutoFormLayout Class Reference

AutoFormLayout provides the abstract base class for form layout engine classes. More...

+ Inheritance diagram for AutoFormLayout:

Public Member Functions

 __construct ($form)
 
 getGroupClass ($name, $collapsible, $collapsed, $additionalClass="")
 
 startGroup ($name, $collapsible=false, $collapsed=false)
 
 endGroup ()
 
 startField ($field, $renderer, $colspan=1, $styles="")
 
 endField ($field, $renderer)
 
 printLabel ($field, $renderer, $styles="", $annotation="")
 
 getLabel ($field, $renderer, $addSuffix=true)
 
 getLabelID ($field)
 
 startUngrouped ()
 
 endUngrouped ()
 
 startButtonLine ()
 
 endButtonLine ()
 
 errorBox ()
 
 requiredFields ($text)
 
 finalizeLayout ()
 

Static Public Member Functions

static create ($type, $form)
 

Public Attributes

 $form
 
 $externalErrorBox = false
 Flag indicating whether the error box should be rendered inside the form grouping. More...
 

Detailed Description

AutoFormLayout provides the abstract base class for form layout engine classes.

When a form is constructed as an AutoForm object, the layout engine provides the HTML structure that the form fields are rendered within. Fakoli provides a number of layout engines for different application styles. You can specify a default layout in your applications config or settings, and can override this value on any AutoForm via the AutoForm::setLayout() method.

Author
andy

Definition at line 15 of file auto_form_layout.inc.

Constructor & Destructor Documentation

◆ __construct()

Member Function Documentation

◆ create()

static AutoFormLayout::create (   $type,
  $form 
)
static

Definition at line 88 of file auto_form_layout.inc.

89  {
90  switch($type)
91  {
92  case "mobile":
93  return new MobileFormLayout($form);
94 
95  case "table_header":
96  return new TableHeaderFormLayout($form);
97 
98  case "table_row":
99  return new TableRowFormLayout($form);
100 
101  case "selectable_table_header":
103 
104  case "selectable_table_row":
106 
107 
108  case "spreadsheet":
109  return new SpreadsheetFormLayout($form);
110 
111  case "simple":
112  return new SimpleFormLayout($form);
113 
114  case "table":
115 
116  default:
117  return new TableBasedFormLayout($form);
118  }
119  }
MobileFormLayout provides a linear form layout suitable for mobile devices.
Overrides the default table-row form layout to provide a selection checkbox for SpreadsheetForms with...
Overrides the default table-row form layout to provide a selection checkbox for SpreadsheetForms with...
SimpleFormLayout provides a form with minimal HTML, and does not employ table-based layout.
Used for the overall layout handling of SpreadsheetAutoForm instance.
Lays out the AutoForm using table-based layout.
Used for the header row in SpreadSheetAutoForm.
Used for each subordinate form row in SpreadSheetAutoForm.

◆ endButtonLine()

◆ endField()

AutoFormLayout::endField (   $field,
  $renderer 
)
abstract

◆ endGroup()

◆ endUngrouped()

◆ errorBox()

◆ finalizeLayout()

AutoFormLayout::finalizeLayout ( )

Reimplemented in TemplateFormLayout.

Definition at line 121 of file auto_form_layout.inc.

122  {
123  }

◆ getGroupClass()

AutoFormLayout::getGroupClass (   $name,
  $collapsible,
  $collapsed,
  $additionalClass = "" 
)

Definition at line 26 of file auto_form_layout.inc.

27  {
28  $class = $this->form->getGroupCSSClass($name);
29  if ($additionalClass) $class = trim("{$additionalClass} $class");
30 
31  if ($collapsible)
32  {
33  $class = ($class) ? "{$class} collapsible" : "collapsible";
34  $class .= $collapsed ? " collapsed" : " expanded";
35  }
36 
37  if ($class)
38  {
39  $class = " class='$class'";
40  }
41 
42  return $class;
43  }

◆ getLabel()

AutoFormLayout::getLabel (   $field,
  $renderer,
  $addSuffix = true 
)

Reimplemented in SpreadsheetFormLayout, TableRowFormLayout, and TableHeaderFormLayout.

Definition at line 53 of file auto_form_layout.inc.

54  {
55  $label = isset($renderer->label) ? $renderer->label : $this->form->prettifyFieldName($field);
56 
57  if ($renderer->parent->markRequiredFields &&
58  $renderer->parent->isRequired($field))
59  {
60  $label .= "*";
61  }
62 
63  $label .= $renderer->labelSuffix;
64 
65  if ($renderer->parent->onFormatLabel)
66  {
67  $fn = $renderer->parent->onFormatLabel;
68  $label = $fn($renderer->parent, $field, $label);
69  }
70 
71  return $label;
72  }

◆ getLabelID()

AutoFormLayout::getLabelID (   $field)

Definition at line 74 of file auto_form_layout.inc.

75  {
76  return "{$this->form->id}_{$field}_label";
77  }

◆ printLabel()

AutoFormLayout::printLabel (   $field,
  $renderer,
  $styles = "",
  $annotation = "" 
)
abstract

◆ requiredFields()

◆ startButtonLine()

◆ startField()

AutoFormLayout::startField (   $field,
  $renderer,
  $colspan = 1,
  $styles = "" 
)
abstract

◆ startGroup()

AutoFormLayout::startGroup (   $name,
  $collapsible = false,
  $collapsed = false 
)
abstract

◆ startUngrouped()

Member Data Documentation

◆ $externalErrorBox

AutoFormLayout::$externalErrorBox = false

Flag indicating whether the error box should be rendered inside the form grouping.

Definition at line 19 of file auto_form_layout.inc.

◆ $form

AutoFormLayout::$form

Definition at line 17 of file auto_form_layout.inc.


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