Framework  3.9
static_field_renderer.inc
Go to the documentation of this file.
1 <?php
7 {
8  function __construct($form, $field, $label)
9  {
10  $this->FieldRenderer($form);
11  if ($form->data->hasField($field))
12  {
13  $form->override($field, $label, $this);
14  }
15  else
16  {
17  $form->add($this, $field);
18  if ($label) $form->alias($field, $label);
19  }
20  }
21 
22  function renderField($field)
23  {
24  $this->_startField($field);
25  $obj = $this->parent->data;
26  if ($obj->hasField($field))
27  {
28  echo $obj->get($field);
29  }
30  else
31  {
32  echo $obj->getDecoration($field);
33  }
34 
35  $this->_endField($field);
36  }
37 
38  function renderReadOnly($field)
39  {
40  $this->renderField($field);
41  }
42 }
43 
FieldRenderer is the abstract base class for all FieldRenderers.
_startField($field, $styles="")
Internal method to generate the starting HTML for the field (including the label)
_endField($field)
Internal method to generate the closing HTML for the field.
FieldRenderer($parent)
Constructor.
__construct($form, $field, $label)
renderField($field)
FieldRenderers must override this method to provide the HTML implementation of the control used to ed...