mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[ticket/12841] Allow extensions to position new config vars
PHPBB3-12841
This commit is contained in:
parent
b132939471
commit
95032c31af
1 changed files with 26 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue