Skip to content

Commit

Permalink
Change langGet and configGet to return normal arrays
Browse files Browse the repository at this point in the history
Return regular arrays rather than associative arrays.
Note that configGet may return an associative array
as the value of a configuration option.
  • Loading branch information
vboctor committed Mar 19, 2017
1 parent 47f6cb8 commit d86a827
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions api/rest/restcore/config_rest.php
Expand Up @@ -96,7 +96,12 @@ function rest_config_get( \Slim\Http\Request $p_request, \Slim\Http\Response $p_
$t_value = config_get_enum_as_array( $t_option, $t_value );
}

$t_configs[$t_option] = $t_value;
$t_config_pair = array(
"option" => $t_option,
"value" => $t_value
);

$t_configs[] = $t_config_pair;
}

# wrap all configs into a configs attribute to allow adding other information if needed in the future
Expand Down Expand Up @@ -133,7 +138,7 @@ function config_get_enum_as_array( $p_enum_name, $p_enum_string_value ) {
foreach( $t_enum_assoc_array as $t_id => $t_name ) {
$t_label = MantisEnum::getLocalizedLabel( $p_enum_string_value, $t_localized_enum_string, $t_id );
$t_enum_entry = array( 'id' => $t_id, 'name' => $t_name, 'label' => $t_label );
$t_enum_array[$t_id] = $t_enum_entry;
$t_enum_array[] = $t_enum_entry;
}

return $t_enum_array;
Expand Down
2 changes: 1 addition & 1 deletion api/rest/restcore/lang_rest.php
Expand Up @@ -58,7 +58,7 @@ function rest_lang_get( \Slim\Http\Request $p_request, \Slim\Http\Response $p_re
continue;
}

$t_localized_strings[$t_string] = array( 'name' => $t_string, 'localized' => lang_get( $t_string ) );
$t_localized_strings[] = array( 'name' => $t_string, 'localized' => lang_get( $t_string ) );
}

$t_result = array( 'strings' => $t_localized_strings );
Expand Down

0 comments on commit d86a827

Please sign in to comment.