src/Extensions/FormExtension.php
public function enableSpamProtection($args = [])
    {
        // Obtain Spam Guard Instance:
        
        if ($guard = $this->getSpamGuardInstance($args)) {
            
            // Define Field Name and Title:
            
            $name  = isset($args['name'])  ? $args['name']  : $guard->getDefaultName();
            $title = isset($args['title']) ? $args['title'] : $guard->getDefaultTitle();
            
            // Obtain Spam Guard Form Field:
            
            if ($field = $guard->getFormField($name, $title)) {
                
                // Link Field with Form:
                
                $field->setForm($this->owner);
                
                // Add Field to Form:
                
                if (isset($args['insertBefore'])) {
                    
                    // Insert Before Specified Field:
                    
                    $this->owner->Fields()->insertBefore($field, $args['insertBefore']);
                    
                } elseif (isset($args['insertAfter'])) {
                    
                    // Insert After Specified Field:
                    
                    $this->owner->Fields()->insertAfter($field, $args['insertAfter']);
                    
                } else {
                    
                    // Push Field to End of List:
                    
                    $this->owner->Fields()->push($field);
                    
                }
                
            }
            
        }
        
        // Answer Extended Form:
        
        return $this->owner;
    }
public function enableSpamProtection($args = [])
    {
        // Obtain Spam Guard Instance:
        
        if ($guard = $this->getSpamGuardInstance($args)) {
            
            // Define Field Name and Title:
            
            $name  = isset($args['name'])  ? $args['name']  : $guard->getDefaultName();
            $title = isset($args['title']) ? $args['title'] : $guard->getDefaultTitle();
            
            // Obtain Spam Guard Form Field:
            
            if ($field = $guard->getFormField($name, $title)) {
                
                // Link Field with Form:
                
                $field->setForm($this->owner);
                
                // Add Field to Form:
                
                if (isset($args['insertBefore'])) {
                    
                    // Insert Before Specified Field:
                    
                    $this->owner->Fields()->insertBefore($field, $args['insertBefore']);
                    
                } elseif (isset($args['insertAfter'])) {
                    
                    // Insert After Specified Field:
                    
                    $this->owner->Fields()->insertAfter($field, $args['insertAfter']);
                    
                } else {
                    
                    // Push Field to End of List:
                    
                    $this->owner->Fields()->push($field);
                    
                }
                
            }
            
        }
        
        // Answer Extended Form:
        
        return $this->owner;
    }
public function enableSpamProtection ( $ args = [ ] ) { // Obtain Spam Guard Instance: if ( $ guard = $ this -> getSpamGuardInstance ( $ args ) ) { // Define Field Name and Title: $ name = isset ( $ args [ 'name' ] ) ? $ args [ 'name' ] : $ guard -> getDefaultName ( ) ; $ title = isset ( $ args [ 'title' ] ) ? $ args [ 'title' ] : $ guard -> getDefaultTitle ( ) ; // Obtain Spam Guard Form Field: if ( $ field = $ guard -> getFormField ( $ name , $ title ) ) { // Link Field with Form: $ field -> setForm ( $ this -> owner ) ; // Add Field to Form: if ( isset ( $ args [ 'insertBefore' ] ) ) { // Insert Before Specified Field: $ this -> owner -> Fields ( ) -> insertBefore ( $ field , $ args [ 'insertBefore' ] ) ; } elseif ( isset ( $ args [ 'insertAfter' ] ) ) { // Insert After Specified Field: $ this -> owner -> Fields ( ) -> insertAfter ( $ field , $ args [ 'insertAfter' ] ) ; } else { // Push Field to End of List: $ this -> owner -> Fields ( ) -> push ( $ field ) ; } } } // Answer Extended Form: return $ this -> owner ; }
Enables spam guard protection for the extended form.

@param array $args

@return Form
Enables spam guard protection for the extended form .