1 | <?php |
||
2 | /** |
||
3 | * Save menu items. |
||
4 | */ |
||
5 | |||
6 | // featured menu items |
||
7 | $featured_names = (array) get_input('featured_menu_names', []); |
||
8 | $featured_names = array_unique($featured_names); |
||
9 | if (in_array(' ', $featured_names)) { |
||
10 | unset($featured_names[array_search(' ', $featured_names)]); |
||
11 | } |
||
12 | elgg_save_config('site_featured_menu_names', $featured_names); |
||
13 | |||
14 | // custom menu items |
||
15 | $custom_menu_titles = get_input('custom_menu_titles', []); |
||
16 | $custom_menu_urls = get_input('custom_menu_urls', []); |
||
17 | $num_menu_items = count($custom_menu_titles); |
||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
18 | $custom_menu_items = []; |
||
19 | for ($i = 0; $i < $num_menu_items; $i++) { |
||
20 | if (trim($custom_menu_urls[$i]) && trim($custom_menu_titles[$i])) { |
||
21 | $url = $custom_menu_urls[$i]; |
||
22 | $title = $custom_menu_titles[$i]; |
||
23 | $custom_menu_items[$title] = $url; |
||
24 | } |
||
25 | } |
||
26 | elgg_save_config('site_custom_menu_items', $custom_menu_items); |
||
27 | |||
28 | return elgg_ok_response('', elgg_echo('admin:menu_items:saved')); |
||
29 |