original_string: public function addField(
          $name,
          $label,
          $type,
          $validationRules = array(),
          $errorHandlers = array(),
          $meta = array(),
          $blnJustRender = false
      ) {
          $objField = static::renderField($name, $label, $type, $validationRules, $errorHandlers, $meta);
  
          $objField->setRequiredStyle($this->__requiredstyle);
  
          if (! $blnJustRender) {
              // *** Fieldset already defined?
              $objFieldset = $this->__elements->getLast("ValidFormBuilder\\Fieldset");
              if ($this->__elements->count() == 0 || ! is_object($objFieldset)) {
                  $objFieldset = $this->addFieldset();
              }
  
              $objField->setMeta("parent", $objFieldset, true);
  
              // *** Add field to the fieldset.
              $objFieldset->addField($objField);
          }
  
          return $objField;
      }
code: public function addField(
          $name,
          $label,
          $type,
          $validationRules = array(),
          $errorHandlers = array(),
          $meta = array(),
          $blnJustRender = false
      ) {
          $objField = static::renderField($name, $label, $type, $validationRules, $errorHandlers, $meta);
  
          $objField->setRequiredStyle($this->__requiredstyle);
  
          if (! $blnJustRender) {
              // *** Fieldset already defined?
              $objFieldset = $this->__elements->getLast("ValidFormBuilder\\Fieldset");
              if ($this->__elements->count() == 0 || ! is_object($objFieldset)) {
                  $objFieldset = $this->addFieldset();
              }
  
              $objField->setMeta("parent", $objFieldset, true);
  
              // *** Add field to the fieldset.
              $objFieldset->addField($objField);
          }
  
          return $objField;
      }
code_tokens: public function addField ( $ name , $ label , $ type , $ validationRules = array ( ) , $ errorHandlers = array ( ) , $ meta = array ( ) , $ blnJustRender = false ) { $ objField = static :: renderField ( $ name , $ label , $ type , $ validationRules , $ errorHandlers , $ meta ) ; $ objField -> setRequiredStyle ( $ this -> __requiredstyle ) ; if ( ! $ blnJustRender ) { // *** Fieldset already defined? $ objFieldset = $ this -> __elements -> getLast ( "ValidFormBuilder\\Fieldset" ) ; if ( $ this -> __elements -> count ( ) == 0 || ! is_object ( $ objFieldset ) ) { $ objFieldset = $ this -> addFieldset ( ) ; } $ objField -> setMeta ( "parent" , $ objFieldset , true ) ; // *** Add field to the fieldset. $ objFieldset -> addField ( $ objField ) ; } return $ objField ; }
docstring: Add a new element to the internal elements collection
  
  *Example; add a text field*:
  ```php
  $objForm->addField(
  "first-name",
  "First name",
  ValidForm::VFORM_STRING,
  array(
  // Make this field required
  "required" => true
  ),
  array(
  // Show this error to indicate this is an required field if no value is submitted
  "required" => "This field is required"
  )
  );
  ```
  @api
  @param string $name The element's name
  @param string $label The element's label
  @param integer $type The element's validation type
  @param array $validationRules Optional.Custom validation rules array
  @param array $errorHandlers Custom error handling array
  @param array $meta Optional. Meta data array
  @param boolean $blnJustRender When true, the element is not added to the internal elements collection.
  `addField()` with `$blnJustRender` set to true is exactly the same as calling `ValidForm::renderField()`
  
  @return \ValidFormBuilder\Element Returns null when no valid type is defined
docstring_tokens: Add a new element to the internal elements collection