Skip to content

Commit

Permalink
[+] value casting fixed in switch component
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrea Fiadone committed Mar 31, 2020
1 parent 1a7d85d commit dd1fcce
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Aeria/Aeria.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
*/
class Aeria extends Container
{
const VERSION = '3.1.12';
const VERSION = '3.1.13';

/**
* Constructs the Aeria container.
Expand Down
18 changes: 18 additions & 0 deletions Aeria/Field/Fields/SwitchField.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,24 @@ public function get(array $saved_fields, bool $skip_filter = false)
return $result;
}

/**
* Gets the field's value and its errors.
*
* @param array $saved_fields the FieldGroup's saved fields
* @param array $errors the saving errors
*
* @return array the field's config, hydrated with values and errors
*
* @since Method available since Release 3.0.0
*/
public function getAdmin(array $saved_fields, array $errors)
{
$savedValues = parent::getAdmin($saved_fields, $errors, true);
$savedValues['value'] = is_null($savedValues['value']) ? null : filter_var($savedValues['value'], FILTER_VALIDATE_BOOLEAN);

return $savedValues;
}

/**
* Saves the new values to the fields.
*
Expand Down
2 changes: 1 addition & 1 deletion aeria.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* Plugin Name: Aeria
* Plugin URI: https://github.com/caffeinalab/aeria
* Description: Aeria is a modular, lightweight, fast WordPress Application development kit.
* Version: 3.1.12
* Version: 3.1.13
* Author: Caffeina
* Author URI: https://caffeina.com
* Text Domain: aeria
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aeria",
"version": "3.1.12",
"version": "3.1.13",
"description": "Aeria",
"scripts": {
"dev": "webpack --watch --mode development",
Expand Down

0 comments on commit dd1fcce

Please sign in to comment.