original_string: public function addField($name, $type, $validationRules = array(), $errorHandlers = array(), $meta = array())
      {
          // Creating dynamic fields inside a multifield is not supported.
          foreach(['dynamic', 'dynamicLabel', 'dynamicRemoveLabel'] as $metaKey) {
              if (array_key_exists($metaKey, $meta)) {
                  unset($meta[$metaKey]);
              }
          }
  
          // Render the field and add it to the multifield field collection.
          $objField = ValidForm::renderField($name, "", $type, $validationRules, $errorHandlers, $meta);
  
          // *** Set the parent for the new field.
          $objField->setMeta("parent", $this, true);
  
          $this->__fields->addObject($objField);
  
          if ($this->__dynamic) {
              // *** The dynamic count can be influenced by a meta value.
              $intDynamicCount = (isset($meta["dynamicCount"])) ? $meta["dynamicCount"] : 0;
  
              $objHiddenField = new Hidden($objField->getId() . "_dynamic", ValidForm::VFORM_INTEGER, array(
                  "default" => $intDynamicCount,
                  "dynamicCounter" => true
              ));
              $this->__fields->addObject($objHiddenField);
  
              $objField->setDynamicCounter($objHiddenField);
          }
  
          return $objField;
      }
code: public function addField($name, $type, $validationRules = array(), $errorHandlers = array(), $meta = array())
      {
          // Creating dynamic fields inside a multifield is not supported.
          foreach(['dynamic', 'dynamicLabel', 'dynamicRemoveLabel'] as $metaKey) {
              if (array_key_exists($metaKey, $meta)) {
                  unset($meta[$metaKey]);
              }
          }
  
          // Render the field and add it to the multifield field collection.
          $objField = ValidForm::renderField($name, "", $type, $validationRules, $errorHandlers, $meta);
  
          // *** Set the parent for the new field.
          $objField->setMeta("parent", $this, true);
  
          $this->__fields->addObject($objField);
  
          if ($this->__dynamic) {
              // *** The dynamic count can be influenced by a meta value.
              $intDynamicCount = (isset($meta["dynamicCount"])) ? $meta["dynamicCount"] : 0;
  
              $objHiddenField = new Hidden($objField->getId() . "_dynamic", ValidForm::VFORM_INTEGER, array(
                  "default" => $intDynamicCount,
                  "dynamicCounter" => true
              ));
              $this->__fields->addObject($objHiddenField);
  
              $objField->setDynamicCounter($objHiddenField);
          }
  
          return $objField;
      }
code_tokens: public function addField ( $ name , $ type , $ validationRules = array ( ) , $ errorHandlers = array ( ) , $ meta = array ( ) ) { // Creating dynamic fields inside a multifield is not supported. foreach ( [ 'dynamic' , 'dynamicLabel' , 'dynamicRemoveLabel' ] as $ metaKey ) { if ( array_key_exists ( $ metaKey , $ meta ) ) { unset ( $ meta [ $ metaKey ] ) ; } } // Render the field and add it to the multifield field collection. $ objField = ValidForm :: renderField ( $ name , "" , $ type , $ validationRules , $ errorHandlers , $ meta ) ; // *** Set the parent for the new field. $ objField -> setMeta ( "parent" , $ this , true ) ; $ this -> __fields -> addObject ( $ objField ) ; if ( $ this -> __dynamic ) { // *** The dynamic count can be influenced by a meta value. $ intDynamicCount = ( isset ( $ meta [ "dynamicCount" ] ) ) ? $ meta [ "dynamicCount" ] : 0 ; $ objHiddenField = new Hidden ( $ objField -> getId ( ) . "_dynamic" , ValidForm :: VFORM_INTEGER , array ( "default" => $ intDynamicCount , "dynamicCounter" => true ) ) ; $ this -> __fields -> addObject ( $ objHiddenField ) ; $ objField -> setDynamicCounter ( $ objHiddenField ) ; } return $ objField ; }
docstring: Add a field to the MultiField collection.
  
  Same as {@link \ValidFormBuilder\ValidForm::addField()} with the only difference that the `MultiField::addField()`
  does not take a field label since that's already set when initialising the `MultiField`.
  
  @param string $name Field name
  @param integer $type Field type
  @param array $validationRules Validation rules array
  @param array $errorHandlers Error handling array
  @param array $meta The meta array
  @return \ValidFormBuilder\Element
docstring_tokens: Add a field to the MultiField collection .