src/Widgets/SubDcaWidget.php
protected function initializeWidget(&$arrField, $strRow, $strKey, $varValue)
    {
        $xlabel = $this->getHelpWizard($strKey, $arrField);

        // Input field callback.
        if (isset($arrField['input_field_callback']) && is_array($arrField['input_field_callback'])) {
            if (!is_object($this->$arrField['input_field_callback'][0])) {
                $this->import($arrField['input_field_callback'][0]);
            }

            return $this->{$arrField['input_field_callback'][0]}->$arrField['input_field_callback'][1]($this, $xlabel);
        }

        $strClass = $this->getWidgetClass($arrField);

        if (empty($strClass)) {
            return null;
        }

        $varValue = $this->handleLoadCallback($arrField, $varValue);
        $arrField = $this->makeMandatory($arrField, $strRow, $strKey);

        $arrField['name']              = $this->strName . '[' . $strRow . '][' . $strKey . ']';
        $arrField['id']                = $this->strId . '_' . $strRow . '_' . $strKey;
        $arrField['value']             = ($varValue !== '') ? $varValue : $arrField['default'];
        $arrField['eval']['tableless'] = true;

        $event = new GetAttributesFromDcaEvent(
            $arrField,
            $arrField['name'],
            $arrField['value'],
            null,
            $this->strTable,
            $this->objDca
        );

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

        $objWidget = new $strClass($event->getResult());

        $objWidget->strId       = $arrField['id'];
        $objWidget->storeValues = true;
        $objWidget->xlabel      = $xlabel;

        return $objWidget;
    }
protected function initializeWidget(&$arrField, $strRow, $strKey, $varValue)
    {
        $xlabel = $this->getHelpWizard($strKey, $arrField);

        // Input field callback.
        if (isset($arrField['input_field_callback']) && is_array($arrField['input_field_callback'])) {
            if (!is_object($this->$arrField['input_field_callback'][0])) {
                $this->import($arrField['input_field_callback'][0]);
            }

            return $this->{$arrField['input_field_callback'][0]}->$arrField['input_field_callback'][1]($this, $xlabel);
        }

        $strClass = $this->getWidgetClass($arrField);

        if (empty($strClass)) {
            return null;
        }

        $varValue = $this->handleLoadCallback($arrField, $varValue);
        $arrField = $this->makeMandatory($arrField, $strRow, $strKey);

        $arrField['name']              = $this->strName . '[' . $strRow . '][' . $strKey . ']';
        $arrField['id']                = $this->strId . '_' . $strRow . '_' . $strKey;
        $arrField['value']             = ($varValue !== '') ? $varValue : $arrField['default'];
        $arrField['eval']['tableless'] = true;

        $event = new GetAttributesFromDcaEvent(
            $arrField,
            $arrField['name'],
            $arrField['value'],
            null,
            $this->strTable,
            $this->objDca
        );

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

        $objWidget = new $strClass($event->getResult());

        $objWidget->strId       = $arrField['id'];
        $objWidget->storeValues = true;
        $objWidget->xlabel      = $xlabel;

        return $objWidget;
    }
Initialize widget.

Based on DataContainer::row() from Contao 2.10.1.

@param array  $arrField The field DCA - might get changed within this routine.

@param string $strRow   The setting name.

@param string $strKey   The widget name.

@param mixed  $varValue The widget value.

@return Widget|null The widget on success, null otherwise.