Skip to content

Commit

Permalink
Fixed incorrect behavior for resource form checkboxes "alias_visible"…
Browse files Browse the repository at this point in the history
… and "syncsite".
  • Loading branch information
sergant210 authored and opengeek committed Oct 19, 2020
1 parent 3f79cda commit 0ca65b1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion manager/controllers/default/resource/create.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ public function process(array $scriptProperties = array()) {
'searchable' => $this->context->getOption('search_default', 1, $this->modx->_userConfig),
'cacheable' => $this->context->getOption('cache_default', 1, $this->modx->_userConfig),
'syncsite' => $this->context->getOption('syncsite_default', 1, $this->modx->_userConfig),
'alias_visible' => $this->context->getOption('alias_visible_default', 1, $this->modx->_userConfig),
));

// Allow certain fields to be prefilled from the OnDocFormRender plugin event
Expand All @@ -140,7 +141,6 @@ public function process(array $scriptProperties = array()) {
} else {
$this->resourceArray = array_merge($this->resourceArray, $reloadData);
$this->resourceArray['resourceGroups'] = array();
$this->resourceArray['syncsite'] = true;
$this->resourceArray['resource_groups'] = $this->modx->getOption('resource_groups',
$this->resourceArray, array());
$this->resourceArray['resource_groups'] = is_array($this->resourceArray['resource_groups']) ?
Expand Down Expand Up @@ -175,6 +175,7 @@ public function process(array $scriptProperties = array()) {
$this->resourceArray['deleted'] = isset($this->resourceArray['deleted']) && intval($this->resourceArray['deleted']) == 1 ? true : false;
$this->resourceArray['uri_override'] = isset($this->resourceArray['uri_override']) && intval($this->resourceArray['uri_override']) == 1 ? true : false;
$this->resourceArray['syncsite'] = isset($this->resourceArray['syncsite']) && intval($this->resourceArray['syncsite']) == 1 ? true : false;
$this->resourceArray['alias_visible'] = isset($this->resourceArray['alias_visible']) && (int)$this->resourceArray['alias_visible'] === 1;
if (!empty($this->resourceArray['parent'])) {
if ($this->parent->get('id') == $this->resourceArray['parent']) {
$this->resourceArray['parent_pagetitle'] = $this->modx->stripTags($this->parent->get('pagetitle'));
Expand Down
1 change: 1 addition & 0 deletions manager/controllers/default/resource/update.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ public function process(array $scriptProperties = array()) {
$this->resourceArray['cacheable'] = intval($this->resourceArray['cacheable']) == 1 ? true : false;
$this->resourceArray['deleted'] = intval($this->resourceArray['deleted']) == 1 ? true : false;
$this->resourceArray['uri_override'] = intval($this->resourceArray['uri_override']) == 1 ? true : false;
$this->resourceArray['alias_visible'] = (int)$this->resourceArray['alias_visible'] === 1;
if (isset($this->resourceArray['syncsite'])) {
$this->resourceArray['syncsite'] = intval($this->resourceArray['syncsite']) == 1 ? true : false;
} else {
Expand Down

0 comments on commit 0ca65b1

Please sign in to comment.