Skip to content

Commit

Permalink
Fix GDPR account content module
Browse files Browse the repository at this point in the history
Content modules could not handle array values.  This modifies
modules_content to match the modules behavior.

Also allows select_multiple to accept an id/text array like the
select menu does.

Both these changes together allow the GDPR module to work.  In
particular, they allow country selection to work.
  • Loading branch information
ecartz committed Jun 16, 2021
1 parent b4ed4ce commit 8c32d0d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
13 changes: 7 additions & 6 deletions admin/includes/classes/config.php
Expand Up @@ -52,14 +52,15 @@ public static function select_multiple($selections, $key_values, $key_name = nul
$string = '';
foreach ($selections as $key => $text) {
if (is_int($key)) {
$key = $text;
if (is_array($text)) {
$key = $text['id'];
$text = $text['text'];
} else {
$key = $text;
}
}

if (isset($key_values[$key]) || array_key_exists($key, $key_values)) {
$checkbox->tick();
} else {
$checkbox->delete('checked');
}
$checkbox->tick(isset($key_values[$key]) || array_key_exists($key, $key_values));

$string .= PHP_EOL . '<br><label>' . $checkbox->set('value', $key) . ' ' . $text . '</label>';
}
Expand Down
4 changes: 4 additions & 0 deletions admin/modules_content.php
Expand Up @@ -98,6 +98,10 @@ function _sortContentModuleFiles($a, $b) {
foreach ( $modules['installed'] as $m ) {
if ( $m['code'] == $class ) {
foreach ($_POST['configuration'] as $key => $value) {
if (is_array($value)) {
$value = implode(';', array_map('Text::prepare', $value));
}

$key = tep_db_prepare_input($key);
$value = tep_db_prepare_input($value);

Expand Down

0 comments on commit 8c32d0d

Please sign in to comment.