classes/Models/Element.php
public function setAttribute($key, $value)
    {
        if ($key == 'type') {
            switch ($value) {
            case 'image': self::$rules['value'] = 'image';
            break;
            case 'file': self::$rules['value'] = 'file';
            break;
            case 'video-encoder': self::$rules['value'] = 'video';
            break;
        }
        }

        // Continue
        return parent::setAttribute($key, $value);
    }
public function setAttribute($key, $value)
    {
        if ($key == 'type') {
            switch ($value) {
            case 'image': self::$rules['value'] = 'image';
            break;
            case 'file': self::$rules['value'] = 'file';
            break;
            case 'video-encoder': self::$rules['value'] = 'video';
            break;
        }
        }

        // Continue
        return parent::setAttribute($key, $value);
    }
public function setAttribute ( $ key , $ value ) { if ( $ key == 'type' ) { switch ( $ value ) { case 'image' : self :: $ rules [ 'value' ] = 'image' ; break ; case 'file' : self :: $ rules [ 'value' ] = 'file' ; break ; case 'video-encoder' : self :: $ rules [ 'value' ] = 'video' ; break ; } } // Continue return parent :: setAttribute ( $ key , $ value ) ; }
Subclass setAttribute so that we can automatically set validation
rules based on the Element type

@param  string $key
@param  mixed  $value
@return void
Subclass setAttribute so that we can automatically set validation rules based on the Element type