RealUrlAutoConfiguration.php 2.68 KB
Newer Older
Dainis Abols's avatar
Dainis Abols committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php

namespace Lu\LuContacts\Hooks;

/**
 * Class RealUrlAutoConfiguration
 * AutoConfiguration-Hook for RealURL
 *
 * @author  Dainis Abols <dainis.abols@lu.lv>
 * @owner   University of Latvia
 * @version 3.0.1
 * @since   04.07.2018
 *
 * @package Lu\LuContacts\Hooks
 */
class RealUrlAutoConfiguration
{

    /**
     * Generates additional RealURL configuration and merges it with provided configuration
     *
     * @param       array $params Default configuration
     *
     * @return      array Updated configuration
     */
    public function addRealUrlConfig($params)
    {
        return array_merge_recursive(
            $params['config'], [
                'postVarSets' => [
                    '_DEFAULT' => [
                        // LU Contacts (3)
                        'meklesana' => [
                            [
                                'GETvar'   => 'tx_lucontacts_pi1[action]',
                                'valueMap' => [
                                    'saraksts' => 'list',
                                    'persona'  => 'person',
                                ],
                            ],
                            [
                                'GETvar'   => 'tx_lucontacts_pi1[listType]',
                                'valueMap' => [
                                    'abc'              => 'surname',
                                    'ekas'             => 'address',
                                    'strukturvienibas' => 'unit',
                                    'meklesana'        => 'search',
                                ],
                                'noMatch'  => 'bypass',
                            ],
                            [
                                'GETvar' => 'tx_lucontacts_pi1[personId]',
                            ],
                        ],
                        'unit'      => [
                            [
                                'GETvar' => 'tx_lucontacts_pi1[unit]',
                            ],
                        ],
                        'query'     => [
                            [
                                'GETvar' => 'tx_lucontacts_pi1[keyword]',
                            ],
                        ],
                        'burts'     => [
                            [
                                'GETvar' => 'tx_lucontacts_pi1[letter]',
                            ],
                        ],
                        'adrese'    => [
                            [
                                'GETvar' => 'tx_lucontacts_pi1[address]',
                            ],
                        ],
                    ],
                ],
            ]
        );
    }
}