src/Widgets/SubDcaWidget.php
protected function makeMandatory($field, $row, $key)
    {
        $field['eval']['required'] = false;
        // Use strlen() here (see contao core issue #3277).
        if (empty($field['eval']['mandatory'])) {
            return $field;
        }

        if (is_array($this->varValue[$row][$key])) {
            if (empty($this->varValue[$row][$key])) {
                $field['eval']['required'] = true;
            }
        } else {
            if (!strlen($this->varValue[$row][$key])) {
                $field['eval']['required'] = true;
            }
        }

        return $field;
    }
protected function makeMandatory($field, $row, $key)
    {
        $field['eval']['required'] = false;
        // Use strlen() here (see contao core issue #3277).
        if (empty($field['eval']['mandatory'])) {
            return $field;
        }

        if (is_array($this->varValue[$row][$key])) {
            if (empty($this->varValue[$row][$key])) {
                $field['eval']['required'] = true;
            }
        } else {
            if (!strlen($this->varValue[$row][$key])) {
                $field['eval']['required'] = true;
            }
        }

        return $field;
    }
Make fields mandatory if necessary.

@param array  $field The field DCA.

@param string $row   The setting name.

@param string $key   The widget name.

@return array