Gregwar\Formidable\Fields\Field::push PHP Method

push() public method

Function called by the dispatcher
public push ( $name, $value = null )
    public function push($name, $value = null)
    {
        switch ($name) {
            case 'name':
                $this->setName($value);
                break;
            case 'type':
                break;
            case 'value':
                $this->setValue($value, true);
                break;
            case 'required':
                $this->required = true;
                break;
            case 'regex':
                $this->regex = $value;
                break;
            case 'minlength':
                $this->minlength = $value;
                break;
            case 'maxlength':
                $this->maxlength = $value;
                $this->attributes['maxlength'] = $value;
                break;
            case 'mapping':
                $this->mapping = $value;
                break;
            case 'prettyname':
                $this->prettyname = $value;
                break;
            case 'readonly':
                $this->readonly = true;
                $this->attributes['readonly'] = 'readonly';
                break;
            default:
                if (preg_match('#^([a-z0-9_-]+)$#mUsi', $name)) {
                    if (null !== $value) {
                        $this->setAttribute($name, $value);
                    } else {
                        $this->setAttribute($name, $name);
                    }
                }
        }
    }

Usage Example

Beispiel #1
0
 public function push($name, $value = null)
 {
     switch ($name) {
         case 'min-entries':
             $this->minEntries = (int) $value;
             return;
         case 'max-entries':
             $this->maxEntries = (int) $value;
             return;
         case 'entries':
             $this->minEntries = (int) $value;
             $this->maxEntries = (int) $value;
             return;
     }
     parent::push($name, $value);
 }
All Usage Examples Of Gregwar\Formidable\Fields\Field::push