diff options
author | Matt Friedman <maf675@gmail.com> | 2014-07-11 10:18:46 -0700 |
---|---|---|
committer | Matt Friedman <maf675@gmail.com> | 2014-07-11 10:18:46 -0700 |
commit | 95032c31af61ced178ce8fe3494abdc514a8ebf2 (patch) | |
tree | 4f6014fb77bbbbd6ac6bef6b2b6facbac4f3224c | |
parent | b13293947140408b634a71085efd7e255f507377 (diff) | |
download | forums-95032c31af61ced178ce8fe3494abdc514a8ebf2.tar forums-95032c31af61ced178ce8fe3494abdc514a8ebf2.tar.gz forums-95032c31af61ced178ce8fe3494abdc514a8ebf2.tar.bz2 forums-95032c31af61ced178ce8fe3494abdc514a8ebf2.tar.xz forums-95032c31af61ced178ce8fe3494abdc514a8ebf2.zip |
[ticket/12841] Allow extensions to position new config vars
PHPBB3-12841
-rw-r--r-- | phpBB/includes/functions_acp.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/phpBB/includes/functions_acp.php b/phpBB/includes/functions_acp.php index 8453da6e6e..13b070b82e 100644 --- a/phpBB/includes/functions_acp.php +++ b/phpBB/includes/functions_acp.php @@ -656,3 +656,29 @@ function validate_range($value_ary, &$error) } } } + +/** +* Inserts new config display_vars into an exisiting display_vars array +* at the given position. +* +* @param array $display_vars An array of existing config display vars +* @param array $add_config_vars An array of new config display vars +* @param array $where Where to place the new config vars, +* before or after an exisiting config, as an array +* of the form: array('after' => 'config_name') +* @return array The array of config display vars +*/ +function insert_config_array($display_vars, $add_config_vars, $where) +{ + if (is_array($where) && array_key_exists(current($where), $display_vars)) + { + $position = array_search(current($where), array_keys($display_vars)) + ((key($where) == 'after') ? 1 : 0); + $display_vars = array_merge( + array_slice($display_vars, 0, $position), + $add_config_vars, + array_slice($display_vars, $position) + ); + } + + return $display_vars; +} |