src/Forms/ConfirmedPasswordField.php
public function setValue($value, $data = null)
    {
        // If $data is a DataObject, don't use the value, since it's a hashed value
        if ($data && $data instanceof DataObject) {
            $value = '';
        }

        //store this for later
        $oldValue = $this->value;

        if (is_array($value)) {
            $this->value = $value['_Password'];
            $this->confirmValue = $value['_ConfirmPassword'];
            $this->currentPasswordValue = ($this->getRequireExistingPassword() && isset($value['_CurrentPassword']))
                ? $value['_CurrentPassword']
                : null;

            if ($this->showOnClick && isset($value['_PasswordFieldVisible'])) {
                $this->getChildren()->fieldByName($this->getName() . '[_PasswordFieldVisible]')
                    ->setValue($value['_PasswordFieldVisible']);
            }
        } else {
            if ($value || (!$value && $this->canBeEmpty)) {
                $this->value = $value;
                $this->confirmValue = $value;
            }
        }

        //looking up field by name is expensive, so lets check it needs to change
        if ($oldValue != $this->value) {
            $this->getChildren()->fieldByName($this->getName() . '[_Password]')
                ->setValue($this->value);

            $this->getChildren()->fieldByName($this->getName() . '[_ConfirmPassword]')
                ->setValue($this->confirmValue);
        }

        return $this;
    }
public function setValue($value, $data = null)
    {
        // If $data is a DataObject, don't use the value, since it's a hashed value
        if ($data && $data instanceof DataObject) {
            $value = '';
        }

        //store this for later
        $oldValue = $this->value;

        if (is_array($value)) {
            $this->value = $value['_Password'];
            $this->confirmValue = $value['_ConfirmPassword'];
            $this->currentPasswordValue = ($this->getRequireExistingPassword() && isset($value['_CurrentPassword']))
                ? $value['_CurrentPassword']
                : null;

            if ($this->showOnClick && isset($value['_PasswordFieldVisible'])) {
                $this->getChildren()->fieldByName($this->getName() . '[_PasswordFieldVisible]')
                    ->setValue($value['_PasswordFieldVisible']);
            }
        } else {
            if ($value || (!$value && $this->canBeEmpty)) {
                $this->value = $value;
                $this->confirmValue = $value;
            }
        }

        //looking up field by name is expensive, so lets check it needs to change
        if ($oldValue != $this->value) {
            $this->getChildren()->fieldByName($this->getName() . '[_Password]')
                ->setValue($this->value);

            $this->getChildren()->fieldByName($this->getName() . '[_ConfirmPassword]')
                ->setValue($this->confirmValue);
        }

        return $this;
    }
public function setValue ( $ value , $ data = null ) { // If $data is a DataObject, don't use the value, since it's a hashed value if ( $ data && $ data instanceof DataObject ) { $ value = '' ; } //store this for later $ oldValue = $ this -> value ; if ( is_array ( $ value ) ) { $ this -> value = $ value [ '_Password' ] ; $ this -> confirmValue = $ value [ '_ConfirmPassword' ] ; $ this -> currentPasswordValue = ( $ this -> getRequireExistingPassword ( ) && isset ( $ value [ '_CurrentPassword' ] ) ) ? $ value [ '_CurrentPassword' ] : null ; if ( $ this -> showOnClick && isset ( $ value [ '_PasswordFieldVisible' ] ) ) { $ this -> getChildren ( ) -> fieldByName ( $ this -> getName ( ) . '[_PasswordFieldVisible]' ) -> setValue ( $ value [ '_PasswordFieldVisible' ] ) ; } } else { if ( $ value || ( ! $ value && $ this -> canBeEmpty ) ) { $ this -> value = $ value ; $ this -> confirmValue = $ value ; } } //looking up field by name is expensive, so lets check it needs to change if ( $ oldValue != $ this -> value ) { $ this -> getChildren ( ) -> fieldByName ( $ this -> getName ( ) . '[_Password]' ) -> setValue ( $ this -> value ) ; $ this -> getChildren ( ) -> fieldByName ( $ this -> getName ( ) . '[_ConfirmPassword]' ) -> setValue ( $ this -> confirmValue ) ; } return $ this ; }
Value is sometimes an array, and sometimes a single value, so we need
to handle both cases.

@param mixed $value
@param mixed $data
@return $this
Value is sometimes an array and sometimes a single value so we need to handle both cases .