Add a total row at the end of the table.

@param string $field Field to compute (must be of type currency)
@param string $name Name of the html input
@param string $label Label of the total
338729
public function addTotalRow($field, $name = null, $label = null)
    {
        if ($name === null) {
            $name = $field;
        }
        if ($label === null) {
            $label = $name;
            $name  = $field;
        }
        $this->totalRow[$field] = array('Field' => $field, 'Name' => $name, 'Label' => $label);
    }
942134
private static function buildWrapper($field, $name, $label = '', $checkbox = false, $required)
        {
            $getter = 'get' . Inflector::camelize($name);
            $error = null;
            $actual = Session::instance('ThinForm')->getActual();

            if (null !== $actual) {
                $error = $actual->getErrors()->$getter();
            }

            $class = 'control-group';

            if (!empty(static::$controlGroupError) && !empty($error)) {
                $class .= ' ' . static::$controlGroupError;
            }

            $id = ' id="control-group-' . $name . '"';
            $out = '<div class="' . $class . '"' . $id . '>';
            $out .= static::buildLabel($name, $label, $required);
            $out .= '<div class="controls">' . PHP_EOL;
            $out .= ($checkbox === true) ? '<label class="checkbox">' : '';
            $out .= $field;

            if (!empty($error)) {
                $out .= '<span class="help-inline">' . $error . '</span>';
            }

            $out .= ($checkbox === true) ? '</label>' : '';
            $out .= '</div>';
            $out .= '</div>' . PHP_EOL;

            return $out;
        }
508894
def add_field(self, name, label, field_type, *args, **kwargs):
        
        if name in self._dyn_fields:
            raise AttributeError('Field already added to the form.')
        else:
            self._dyn_fields[name] = {'label': label, 'type': field_type,
                                      'args': args, 'kwargs': kwargs}
178013
public function addLabelDate($name, $label = '')
    {
        $e = new \FrenchFrogs\Form\Element\LabelDate($name, $label);
        $this->addElement($e);

        return $e;
    }
66753
public function addBoolean($name, $label = '', $attr = [])
    {

        $c = new Column\Boolean($name, $label, $attr);
        $this->addColumn($c);

        return $c;
    }
103981
public function addDateTime($name, $label)
	{
		$comp = new DateTimeInput($label);
		$this->addComponent($comp, $name);

		return $comp;
	}
1359230
public static function make($name, $label = '')
    {
        return parent::make($name, $label)->separator(',')->options(
            Options::make()->append('', 1)
        );
    }
700071
public function key($name, $label = null)
    {
        $this->lastKey = $name;

        // Rest previous key's last rule
        $this->lastRule = null;

        if (!isset($this->options['rules'][$name])) {
            $this->options['rules'][$name] = [];
        }

        if (isset($label)) {
            $this->label($label);
        }

        return $this;
    }
1058650
public function addFields($fields=NULL, $label=NULL) {
		if (isset($fields)) {
			if (!$fields instanceof HtmlFormFields) {
				if (!\is_array($fields)) {
					$fields=\func_get_args();
					$end=\end($fields);
					if (\is_string($end)) {
						$label=$end;
						\array_pop($fields);
					} else
						$label=NULL;
				}
				$this->_fields=\array_merge($this->_fields, $fields);
				$fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count(), $fields);
			}
			if (isset($label)){
				$fields->wrap("<div class='field'><label>{$label}</label>","</div>");
			}
		} else {
			$fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count());
		}
		$this->addItem($fields);
		return $fields;
	}
63444
protected function checkbox($name, $label = null, $value = null, $note = null) {
		$data = is_array($value) ? $value + ['note' => $note] : (
			is_bool($value)
			? ['checked' => $value, 'note' => $note]
			: ['note' => $value]
		);
		return $this->field($name, Checkbox::class, $label, [
			'checked' => Checkbox::b($this->v($name), df_bool(dfa($data, 'checked')))
		] + $data);
	}
662572
public function addDate($name, $label = '', $format = null, $attr = [])
    {
        $c = new Column\Date($name, $label, $format, $attr);
        $this->addColumn($c);
        return $c;
    }
703146
public function addField($name, $decorator = null, $field = null)
    {
        if (!is_string($name)) {
            throw new Exception(['Format for addField now require first argument to be name']);
        }

        if (!$this->form->model) {
            $this->form->model = new \atk4\ui\misc\ProxyModel();
        }

        if (is_string($field)) {
            $field = ['type' => $field];
        }

        if ($name) {
            $existingField = $this->form->model->hasElement($name);
        }

        try {
            if (!$existingField) {
                // Add missing field
                if ($field) {
                    $field = $this->form->model->addField($name, $field);
                } else {
                    $field = $this->form->model->addField($name);
                }
            } elseif (is_array($field)) {
                // Add properties to existing field
                $existingField->setDefaults($field);
                $field = $existingField;
            } elseif (is_object($field)) {
                throw new Exception(['Duplicate field', 'name' => $name]);
            } else {
                $field = $existingField;
            }

            if (is_string($decorator)) {
                $decorator = $this->form->decoratorFactory($field, ['caption' => $decorator]);
            } elseif (is_array($decorator)) {
                $decorator = $this->form->decoratorFactory($field, $decorator);
            } elseif (!$decorator) {
                $decorator = $this->form->decoratorFactory($field);
            } elseif (is_object($decorator)) {
                if (!$decorator instanceof \atk4\ui\FormField\Generic) {
                    throw new Exception(['Field decorator must descend from \atk4\ui\FormField\Generic', 'decorator' => $decorator]);
                }
                $decorator->field = $field;
                $decorator->form = $this->form;
            } else {
                throw new Exception(['Value of $decorator argument is incorrect', 'decorator' => $decorator]);
            }
        } catch (\Throwable $e) {
            throw new Exception(['Unable to add form field', 'name' => $name, 'decorator' => $decorator, 'field' => $field], null, $e);
        }

        return $this->_addField($decorator, $field);
    }
283053
final protected function textarea($name, $label = null, $data = []) {return $this->field(
		$name, Textarea::class, $label, $data
	);}
241333
public function addContainer($name, $label = '', $attr = [])
    {
        $c = new Column\Container($name, $label, $attr);
        $this->addColumn($c);
        return $c;
    }
1100545
public function addElement(FieldsetInterface &$form, $name, $data)
    {
        if ($data['type'] == 'fieldset') {
            $fieldset = new Fieldset(['name' => $name]);
            foreach ($data['elements'] as $key => $def) {
                $this->addElement($fieldset, $key, $def);
            }
            $form->add($fieldset);
        } else {
            if (array_key_exists($data['type'], static::$_elementAlias)) {
                $class = static::$_elementAlias[$data['type']];
            } else if (
                is_subclass_of($data['type'], 'Slick\Form\ElementInterface')
            ) {
                $class = $data['type'];
            } else {
                throw new Exception\UnknownElementException(
                    "'{$data['type']}' is not a known alias or an implementation of " .
                    "Slick\\Form\\ElementInterface interface"
                );
            }

            /** @var Element $element */
            $element = new $class(['name' => $name]);

            if (isset($data['input'])) {
                $element->input = InputFilterFactory::createInput(
                    $data['input'],
                    $element->getName()
                );
            }

            if (!empty($data['validate'])) {
                $this->addValidation($element, $data['validate']);
            }

            foreach (array_keys($this->_elementProperties) as $key) {
                if (isset($data[$key])) {
                    $element->$key = $data[$key];
                }
            }

            $form->add($element);
        }
    }
4590
public function replaceField($name, $field)
    {
        $index = $this->getFieldIndex($name);
        $this->removeFieldAtIndex($index);
        $this->insertFields($field, $index);
    }
102961
public function createTab($name, $label, $options = array())
    {
        $options = array_replace(
            $options,
            array(
                'label' => $label,
                'inherit_data' => true,
            ));

        $tab = $this->formBuilder->create($name, TabsTabType::class, $options);
        $this->formBuilder->get('tabs')->add($tab);

        return $tab;
    }