TypoLink in flexform for TYPO3

How to add TypoLink in flexform

TYPO3 7

<settings.link>
    <TCEforms>
        <exclude>1</exclude>
        <label>
            Link to Page or a File or a Content-Element
        </label>
        <config>
            <type>input</type>
            <size>30</size>
            <eval>trim</eval>
            <softref>typolink,typolink_tag,images,url</softref>
            <wizards>
                <_PADDING>2</_PADDING>
                <link>
                    <type>popup</type>
                    <title>Link</title>
                    <module>
                        <name>wizard_element_browser</name>
                        <urlParameters>
                            <mode>wizard</mode>
                        </urlParameters>
                    </module>
                    <icon>link_popup.gif</icon>
                    <script>browse_links.php?mode=wizard</script>
                    <params>
                        <!--<blindLinkOptions>page,file,folder,url,spec</blindLinkOptions>-->
                    </params>
                    <JSopenParams>height=500,width=500,status=0,menubar=0,scrollbars=1</JSopenParams>
                </link>
            </wizards>
        </config>
    </TCEforms>
</settings.link>

TYPO3 8

<settings.link>
    <TCEforms>
        <label>Link to Page or a File or a Content-Element</label>
        <exclude>0</exclude>
        <config>
            <type>input</type>
            <renderType>inputLink</renderType>
            <!--
            <fieldControl>
                <linkPopup>
                    <options>
                        <blindLinkOptions>file,folder,mail,page,spec</blindLinkOptions>
                    </options>
                </linkPopup>
            </fieldControl>
            -->
        </config>
    </TCEforms>
</settings.link>

Source: https://gist.github.com/alrnz/b650b389ccc757eb08a907f64cba19b1