public function getInlineElements(
        $data,
        $name,
        $cType,
        $parentFieldName = "parentid",
        $parenttable = "tt_content",
        $childTable = null
    ) {
        // if the name of the child table is not explicitely given, take field key
        if (!$childTable) {
            $childTable = $name;
        }

        // If this method is called in backend, there is no $GLOBALS['TSFE']
        if (TYPO3_MODE == 'FE' && isset($GLOBALS['TSFE']->sys_language_uid)) {
            $sysLangUid = $GLOBALS['TSFE']->sys_language_uid;
            $enableFields = $GLOBALS['TSFE']->cObj->enableFields($childTable);
        } else {
            $sysLangUid = $data['sys_language_uid'];
            $enableFields = " AND " . $childTable . ".deleted = 0";
        }

        // by default, the uid of the parent is $data["uid"]
        $parentUid = $data["uid"];

        if ($GLOBALS['TSFE']->sys_language_uid != 0 && $data["_LOCALIZED_UID"] != "") {
            $parentUid = $data["_LOCALIZED_UID"];
        }

        $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($childTable);
        $queryBuilder
            ->select('*')
            ->from($childTable)
            ->where($queryBuilder->expr()->eq($parentFieldName, $parentUid))
            ->orderBy('sorting');

        if ($childTable !== 'tt_content') {
            $queryBuilder->andWhere('parenttable LIKE :parenttable');
            $queryBuilder->setParameter('parenttable', $parenttable);
        }

        $rows = $queryBuilder->execute()->fetchAll();

        // and recursively add them to an array
        $elements = array();
        foreach ($rows as $element) {
            if (TYPO3_MODE == 'FE') {
                $GLOBALS['TSFE']->sys_page->versionOL($childTable, $element);
            } else {
                $element = BackendUtility::getRecordWSOL($childTable, $element['uid']);
            }
            if ($element && empty($elements[$element['uid']])) {
                $this->addIrreToData($element, $name, $cType);
                $this->addFilesToData($element, $name);
                $elements[$element['uid']] = $element;
            }
        }

        return $elements;
    }