Skip to content

Commit

Permalink
Merge branch 'release/2.0.7'
Browse files Browse the repository at this point in the history
  • Loading branch information
rhukster committed Nov 18, 2016
2 parents 6723ddd + 19eace0 commit 07f1d12
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 17 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# v2.0.7
## 11/17/2016

1. [](#improved)
* Added method to set all data in a form
* Added params to form action URL
* Added ability to add ids to buttons and to set them disabled
1. [](#bugfix)
* Moved Files Upload GC logic to function in front-end only

# v2.0.6
## 10/19/2016

Expand Down
2 changes: 1 addition & 1 deletion blueprints.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Form
version: 2.0.6
version: 2.0.7
description: Enables the forms handling
icon: check-square
author:
Expand Down
5 changes: 5 additions & 0 deletions classes/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,11 @@ public function setData($name = null, $value = '')
return true;
}

public function setAllData($array)
{
$this->data = new Data($array);
}

/**
* Handles ajax upload for files.
* Stores in a flash object the temporary file and deals with potential file errors.
Expand Down
26 changes: 13 additions & 13 deletions form.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,21 +202,21 @@ public function onPagesInitialized()
}
}
}
}

// Clear flash objects for previously uploaded files
// whenever the user switches page / reloads
// ignoring any JSON / extension call
if (is_null($this->grav['uri']->extension()) && !$submitted) {
// Discard any previously uploaded files session.
// and if there were any uploaded file, remove them from the filesystem
if ($flash = $this->grav['session']->getFlashObject('files-upload')) {
$flash = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($flash));
foreach ($flash as $key => $value) {
if ($key !== 'tmp_name') {
continue;
// Clear flash objects for previously uploaded files
// whenever the user switches page / reloads
// ignoring any JSON / extension call
if (is_null($this->grav['uri']->extension()) && !$submitted) {
// Discard any previously uploaded files session.
// and if there were any uploaded file, remove them from the filesystem
if ($flash = $this->grav['session']->getFlashObject('files-upload')) {
$flash = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($flash));
foreach ($flash as $key => $value) {
if ($key !== 'tmp_name') {
continue;
}
@unlink($value);
}
@unlink($value);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions languages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ hr:
hu:
PLUGIN_FORM:
NOT_VALIDATED: "Érvénytelen az űrlap. Egy vagy több kötelező mező nincs kitöltve."
NONCE_NOT_VALIDATED: "Upsz, van egy kis probléma, kérlek nézd át az űrlapot, majd küld el újra."
NONCE_NOT_VALIDATED: "Upsz, van egy kis probléma, kérlek nézd át az űrlapot, majd küldd el újra."
FILES: "Fájlok Feltöltése"
ALLOW_MULTIPLE: "Több fájl feltöltése"
ALLOW_MULTIPLE_HELP: "Engedélyezi egyszerre több állomány felöltését."
ALLOW_MULTIPLE_HELP: "Engedélyezi egyszerre több állomány feltöltését."
DESTINATION: "Feltöltés Helye"
DESTINATION_HELP: "Ide lesznek feltöltve az állományok"
ACCEPT: "Engedélyezett MIME-típusok"
Expand Down
4 changes: 3 additions & 1 deletion templates/forms/default/form.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{% endif %}
{% endfor %}

{% set action = form.action ? base_url ~ form.action : base_url ~ page.route %}
{% set action = form.action ? base_url ~ form.action : base_url ~ page.route ~ uri.params %}

{% if (action == base_url_relative) %}
{% set action = base_url_relative ~ '/' ~ page.slug %}
Expand Down Expand Up @@ -50,9 +50,11 @@

{% for button in form.buttons %}
<button
{% if button.id %}id="{{ button.id }}"{% endif %}
{% block button_classes %}
class="{{ button.classes|default('button') }}"
{% endblock %}
{% if button.disabled %}disabled="disabled"{% endif %}
type="{{ button.type|default('submit') }}"
>
{{ button.value|t|default('Submit') }}
Expand Down

0 comments on commit 07f1d12

Please sign in to comment.