Skip to content

Commit 8e8cbd5

Browse files
committed
Merge pull request #21 from VSEphpbb/update-function
Use new phpbb core function to insert config vars
2 parents 39e11fb + 4a19233 commit 8e8cbd5

1 file changed

Lines changed: 3 additions & 10 deletions

File tree

event/listener.php

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -98,16 +98,9 @@ public function add_googleanalytics_configs($event)
9898
),
9999
);
100100

101-
// Insert the config vars after override_user_style
102-
$insert_after = 'override_user_style';
103-
104-
// Rebuild new config var array
105-
$position = array_search($insert_after, array_keys($display_vars['vars'])) + 1;
106-
$display_vars['vars'] = array_merge(
107-
array_slice($display_vars['vars'], 0, $position),
108-
$ga_config_vars,
109-
array_slice($display_vars['vars'], $position)
110-
);
101+
// Add the new config vars after override_user_style in the display_vars config array
102+
$insert_after = array('after' => 'override_user_style');
103+
$display_vars['vars'] = phpbb_insert_config_array($display_vars['vars'], $ga_config_vars, $insert_after);
111104

112105
// Update the display_vars event with the new array
113106
$event['display_vars'] = $display_vars;

0 commit comments

Comments
 (0)