protected function prepareFrontendFilterWidget(
        $arrWidget,
        $arrFilterUrl,
        $arrJumpTo,
        FrontendFilterOptions $objFrontendFilterOptions
    ) {
        $strClass = $GLOBALS['TL_FFL'][$arrWidget['inputType']];

        // No widget? no output! that's it.
        if (!$strClass) {
            return array();
        }

        // Determine current value.
        $arrWidget['value'] = isset($arrFilterUrl[$arrWidget['eval']['urlparam']])
            ? $arrFilterUrl[$arrWidget['eval']['urlparam']]
            : null;

        $event = new GetAttributesFromDcaEvent(
            $arrWidget,
            $arrWidget['eval']['urlparam']
        );

        $this->eventDispatcher->dispatch(
            ContaoEvents::WIDGET_GET_ATTRIBUTES_FROM_DCA,
            $event
        );

        if ($objFrontendFilterOptions->isAutoSubmit() && TL_MODE == 'FE') {
            $GLOBALS['TL_JAVASCRIPT']['metamodels'] = 'bundles/metamodelscore/js/metamodels.js';
        }

        /** @var \Widget $objWidget */
        $objWidget = new $strClass($event->getResult());
        $this->validateWidget($objWidget, $arrWidget['value']);
        $strField = $objWidget->generateWithError();

        return array
        (
            'class'      => sprintf(
                'mm_%s %s%s%s',
                $arrWidget['inputType'],
                $arrWidget['eval']['urlparam'],
                (($arrWidget['value'] !== null) ? ' used' : ' unused'),
                ($objFrontendFilterOptions->isAutoSubmit() ? ' submitonchange' : '')
            ),
            'label'      => $objWidget->generateLabel(),
            'formfield'  => $strField,
            'raw'        => $arrWidget,
            'urlparam'   => $arrWidget['eval']['urlparam'],
            'options'    => $this->prepareFrontendFilterOptions(
                $arrWidget,
                $arrFilterUrl,
                $arrJumpTo,
                $objFrontendFilterOptions->isAutoSubmit()
            ),
            'count'      => isset($arrWidget['count']) ? $arrWidget['count'] : null,
            'showCount'  => $objFrontendFilterOptions->isShowCountValues(),
            'autosubmit' => $objFrontendFilterOptions->isAutoSubmit(),
            'urlvalue'   => array_key_exists('urlvalue', $arrWidget) ? $arrWidget['urlvalue'] : $arrWidget['value'],
            'errors'     => $objWidget->hasErrors() ? $objWidget->getErrors() : array()
        );
    }