Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it easier to override the FrontendCustomerUserFormProvider #8

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function getCustomerUserForm(CustomerUser $customerUser)
*/
public function getForgotPasswordFormView(array $options = [])
{
$options['action'] = $this->generateUrl(self::ACCOUNT_USER_RESET_REQUEST_ROUTE_NAME);
$options['action'] = $options['action'] ?? $this->generateUrl(static::ACCOUNT_USER_RESET_REQUEST_ROUTE_NAME);

return $this->getFormView(CustomerUserPasswordRequestType::class, null, $options);
}
Expand All @@ -63,7 +63,7 @@ public function getForgotPasswordFormView(array $options = [])
*/
public function getForgotPasswordForm(array $options = [])
{
$options['action'] = $this->generateUrl(self::ACCOUNT_USER_RESET_REQUEST_ROUTE_NAME);
$options['action'] = $options['action'] ?? $this->generateUrl(static::ACCOUNT_USER_RESET_REQUEST_ROUTE_NAME);

return $this->getForm(CustomerUserPasswordRequestType::class, null, $options);
}
Expand All @@ -75,7 +75,7 @@ public function getForgotPasswordForm(array $options = [])
*/
public function getResetPasswordFormView(CustomerUser $customerUser = null)
{
$options['action'] = $this->generateUrl(self::ACCOUNT_USER_PASSWORD_RESET_ROUTE_NAME);
$options['action'] = $this->generateUrl(static::ACCOUNT_USER_PASSWORD_RESET_ROUTE_NAME);

return $this->getFormView(CustomerUserPasswordResetType::class, $customerUser, $options);
}
Expand All @@ -87,7 +87,7 @@ public function getResetPasswordFormView(CustomerUser $customerUser = null)
*/
public function getResetPasswordForm(CustomerUser $customerUser = null)
{
$options['action'] = $this->generateUrl(self::ACCOUNT_USER_PASSWORD_RESET_ROUTE_NAME);
$options['action'] = $this->generateUrl(static::ACCOUNT_USER_PASSWORD_RESET_ROUTE_NAME);

return $this->getForm(CustomerUserPasswordResetType::class, $customerUser, $options);
}
Expand Down Expand Up @@ -127,12 +127,12 @@ private function getCustomerUserFormOptions(CustomerUser $customerUser)

if ($customerUser->getId()) {
$options['action'] = $this->generateUrl(
self::ACCOUNT_USER_UPDATE_ROUTE_NAME,
static::ACCOUNT_USER_UPDATE_ROUTE_NAME,
['id' => $customerUser->getId()]
);
} else {
$options['action'] = $this->generateUrl(
self::ACCOUNT_USER_CREATE_ROUTE_NAME
static::ACCOUNT_USER_CREATE_ROUTE_NAME
);
}

Expand All @@ -147,9 +147,10 @@ private function getCustomerUserFormOptions(CustomerUser $customerUser)
private function getProfilerFormOptions(CustomerUser $customerUser)
{
$options = [];

if ($customerUser->getId()) {
$options['action'] = $this->generateUrl(
self::ACCOUNT_USER_PROFILE_UPDATE_ROUTE_NAME,
static::ACCOUNT_USER_PROFILE_UPDATE_ROUTE_NAME,
['id' => $customerUser->getId()]
);

Expand Down