Exemplo n.º 1
0
 /**
  * Set value for database field from form.
  *
  * @author   Krzysztof Trzos
  * @access   protected
  * @param    string     $sName
  * @param    mixed      $mValue
  * @param    Form\Field $oFormField
  * @return   boolean
  * @since    1.0.1-dev, 2015-02-20
  * @version  2.1.1-dev
  */
 protected function makeDataTransfer($sName, $mValue, Form\Field &$oFormField)
 {
     $sCurrentRoute = Router::getCurrentRouteName();
     $aCurrentRouteParams = Router::getParams();
     switch ($sName) {
         case 'password':
             switch ($sCurrentRoute) {
                 case 'backend':
                     if ($aCurrentRouteParams['controller'] === 'user' && $aCurrentRouteParams['action'] === 'edit') {
                         if (empty($mValue['und'][0])) {
                             return FALSE;
                         }
                     }
                     break;
             }
             break;
     }
     return parent::makeDataTransfer($sName, $mValue, $oFormField);
 }
Exemplo n.º 2
0
 /**
  * Generate model form basing on model config.
  *
  * @static
  * @access   public
  * @throws   Exception\Fatal
  * @param    string                    $formName
  * @param    ModelCore\ModelFormConfig $config
  * @return   ModelCore\ModelForm
  * @since    1.0.0-alpha
  * @version  1.0.0-alpha
  */
 public function form($formName, ModelCore\ModelFormConfig $config = NULL)
 {
     return ModelCore\ModelForm::factory($this, $formName, $config);
 }