public function checkForRootColumn($contentId)
    {
        $queryBuilder = $this->getQueryBuilder();
        $queryBuilder
            ->getRestrictions()
            ->removeAll();
        $parent = $queryBuilder
            ->select('t1.colPos', 't1.tx_gridelements_container')
            ->from('tt_content', 't1')
            ->join(
                't1',
                'tt_content',
                't2',
                $queryBuilder->expr()->eq('t1.uid', $queryBuilder->quoteIdentifier('t2.tx_gridelements_container'))
            )
            ->where(
                $queryBuilder->expr()->eq(
                    't2.uid',
                    $queryBuilder->createNamedParameter((int)$contentId, \PDO::PARAM_INT)
                )
            )
            ->execute()
            ->fetch();
        if (!empty($parent) && $parent['tx_gridelements_container'] > 0) {
            $colPos = $this->checkForRootColumn($parent['tx_gridelements_container']);
        } else {
            $colPos = (int)$parent['colPos'];
        }

        return $colPos;
    }
public function checkForRootColumn($contentId)
    {
        $queryBuilder = $this->getQueryBuilder();
        $queryBuilder
            ->getRestrictions()
            ->removeAll();
        $parent = $queryBuilder
            ->select('t1.colPos', 't1.tx_gridelements_container')
            ->from('tt_content', 't1')
            ->join(
                't1',
                'tt_content',
                't2',
                $queryBuilder->expr()->eq('t1.uid', $queryBuilder->quoteIdentifier('t2.tx_gridelements_container'))
            )
            ->where(
                $queryBuilder->expr()->eq(
                    't2.uid',
                    $queryBuilder->createNamedParameter((int)$contentId, \PDO::PARAM_INT)
                )
            )
            ->execute()
            ->fetch();
        if (!empty($parent) && $parent['tx_gridelements_container'] > 0) {
            $colPos = $this->checkForRootColumn($parent['tx_gridelements_container']);
        } else {
            $colPos = (int)$parent['colPos'];
        }

        return $colPos;
    }
public function checkForRootColumn ( $ contentId ) { $ queryBuilder = $ this -> getQueryBuilder ( ) ; $ queryBuilder -> getRestrictions ( ) -> removeAll ( ) ; $ parent = $ queryBuilder -> select ( 't1.colPos' , 't1.tx_gridelements_container' ) -> from ( 'tt_content' , 't1' ) -> join ( 't1' , 'tt_content' , 't2' , $ queryBuilder -> expr ( ) -> eq ( 't1.uid' , $ queryBuilder -> quoteIdentifier ( 't2.tx_gridelements_container' ) ) ) -> where ( $ queryBuilder -> expr ( ) -> eq ( 't2.uid' , $ queryBuilder -> createNamedParameter ( ( int ) $ contentId , \ PDO :: PARAM_INT ) ) ) -> execute ( ) -> fetch ( ) ; if ( ! empty ( $ parent ) && $ parent [ 'tx_gridelements_container' ] > 0 ) { $ colPos = $ this -> checkForRootColumn ( $ parent [ 'tx_gridelements_container' ] ) ; } else { $ colPos = ( int ) $ parent [ 'colPos' ] ; } return $ colPos ; }
Function to recursively determine the colPos of the root container
so that an element that has been removed from any container
will still remain in the same major page column

@param int $contentId The uid of the current content element

@return int The new column of this content element
Function to recursively determine the colPos of the root container so that an element that has been removed from any container will still remain in the same major page column