Configuration

When client starts using the widget, certain settings must be applied in order for the widget to be displayed correctly in the client’s website. These settings are done on integration level and are applied only for that integration widget. Those settings are located in the integration’s domain config file. For example for the integration themenwelten.rp-online.de we have the following settings inside config/domains/themenwelten.rp-online.de.php

    'widget' => [
        'height' => '860px',
        'height_mobile' => '750px',
        '1b0d66e7907ea64420e29f77154e58f9' => [
            'height' => '375px',
            'height_mobile' => '850px',
            'selector' => '#trm-widget-1b0d66e7907ea64420e29f77154e58f9',
        ],
        '3e013248386122288086d791ef7c3042' => [
            'height' => '290px',
            'height_mobile' => '750px',
            'selector' => '#trm-widget-3e013248386122288086d791ef7c3042',
        ],
        'ba959099f28675866fbd157fb8461321' => [
            'height' => '355px',
            'height_mobile' => '380px',
            'selector' => '#trm-widget-ba959099f28675866fbd157fb8461321',
        ],
        '6105e84b37d723afcf5eaa1295a01b46' => [
            'height' => '355px',
            'height_mobile' => '380px',
            'selector' => '#trm-widget-6105e84b37d723afcf5eaa1295a01b46', 
        ]
    ],

Default Widget Configuration

First we have defined the default height (for desktop devices) and the height_mobile settings. The first setting is being applied only to desktop devices and the second only to mobile devices. Then we might have a selector setting. This is the DOM selector of the main html container that the widget will be wrapped around (iframe tag). Without this selector the script cannot properly set the height of the widget. This selector is usually an id selector with the folllowing naming convetion: #trm-widget-[widget-alias]

Widget specific configuration

If a client/integration has more then one widget then widget specific config must be applied. Since every widget has a unique alias to it, we use this alias to identify then widget and set it’s configs. Example:

    'height' => '860px',
    'height_mobile' => '750px',
    '1b0d66e7907ea64420e29f77154e58f9' => [
        'height' => '375px',
        'height_mobile' => '850px',
        'selector' => '#trm-widget-1b0d66e7907ea64420e29f77154e58f9',
    ],

This means that the widget will have height:860px for Desktop and height:750px for mobile except the widget has alias equal to 1b0d66e7907ea64420e29f77154e58f9. If the widget is with alias=1b0d66e7907ea64420e29f77154e58f9 then the height for it will be 375px for desktop and 850px for mobile devices.

The code responsible for reading these config values is located: app/Http/Controllers/WidgetFrontEndController.php