Skip to content

Commit

Permalink
see cl 1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Kunitzsch committed Apr 14, 2020
1 parent 8f4379f commit 4c3d4ab
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
@@ -1,6 +1,9 @@
# Changelog
All notable changes to this project will be documented in this file.

## [1.0.1] - 2020-04-14
- fixed resolving wether reset button was clicked when `clickedButton` is not set for form

## [1.0.0] - 2020-04-14
- added async form submit support to select fields
- updated import in filter bundle js
Expand Down
15 changes: 5 additions & 10 deletions src/Config/FilterConfig.php
Expand Up @@ -313,22 +313,17 @@ protected function isResetButtonClicked(FormInterface $form): bool
{
if(!(null !== $form->getClickedButton() && \in_array($form->getClickedButton()->getName(),
$this->getResetNames(), true))) {
return $this->isAsyncResetButtonClicked();
return $this->isResetButtonClickedFromRequest();
}

return true;
}

protected function isAsyncResetButtonClicked(): bool
protected function isResetButtonClickedFromRequest(): bool
{
$request = $this->container->get('huh.request');

if(!$request->isXmlHttpRequest()) {
return false;
}

$data = in_array($request->getMethod(), ['GET', 'HEAD']) ? $request->getGet($this->getFilter()['name']) : $request->getPost($this->getFilter()['name']);

$request = $this->container->get('huh.request');
$data = in_array($request->getMethod(), ['GET', 'HEAD']) ? $request->getGet($this->getFilter()['name']) : $request->getPost($this->getFilter()['name']);

return isset($data['reset']);
}

Expand Down

0 comments on commit 4c3d4ab

Please sign in to comment.