Skip to content

Commit

Permalink
Update to 1.2.3
Browse files Browse the repository at this point in the history
- Fixing javascript issues with not valid hide/show tv values
  • Loading branch information
Jako committed Apr 7, 2016
1 parent 3ccec80 commit 10540c4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion assets/components/toggletvset/mgr/js/toggletvset.min.js

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

2 changes: 2 additions & 0 deletions core/components/toggletvset/docs/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Changelog for ToggleTVSet
=========================

- 1.2.3
- Fixing javascript issues with not valid hide/show tv values
- 1.2.2
- Fixing toggling more than one set
- 1.2.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ToggleTVSet
* The version
* @var string $version
*/
public $version = '1.2.1';
public $version = '1.2.3';

/**
* The class options
Expand Down Expand Up @@ -95,24 +95,23 @@ function __construct(modX &$modx, $options = array())
$hidetvs = array_merge($hidetvs, array_map('trim', explode(',', $element[1])));
}
}
$hidetvs = array_unique($hidetvs);
$hidetvs = array_values(array_unique($hidetvs));
if ($this->modx->resource) {
$tvr = $modx->getObject('modTemplateVarResource', array(
'tmplvarid' => $toggletv,
'contentid' => $this->modx->resource->get('id')
));
if ($tvr) {
$tvvalue = $tvr->get('value');
}
else {
} else {
$tv = $modx->getObject('modTemplateVar', $toggletv);
$tvvalue = ($tv) ? $tv->get('default_text') : '';
}
if ($tvvalue) {
$showtvs = array_merge($showtvs, array_map('trim', explode(',', $tvvalue)));
}
}
$showtvs = array_unique($showtvs);
$showtvs = array_values(array_unique($showtvs));
}
}

Expand Down Expand Up @@ -155,10 +154,12 @@ public function getOption($key, $options = array(), $default = null)
* @param bool $default
* @return bool
*/
public function getBooleanOption($name, array $options = null, $default = null) {
public function getBooleanOption($name, array $options = null, $default = null)
{
$option = $this->getOption($name, $options, $default);
return $this->castValueToBool($option);
}

/**
* Turns a value into a boolean. This checks for "false" and "no" strings, as well as anything PHP can automatically
* cast to a boolean value.
Expand Down

0 comments on commit 10540c4

Please sign in to comment.