public function onSaveType($value, $dc)
    {
        if ('root' !== $value && 'folder' !== $value && $dc->activeRecord->pid === 0) {
            throw new \Exception($GLOBALS['TL_LANG']['ERR']['topLevelRoot']);
        }

        return $value;
    }
public function onSaveType($value, $dc)
    {
        if ('root' !== $value && 'folder' !== $value && $dc->activeRecord->pid === 0) {
            throw new \Exception($GLOBALS['TL_LANG']['ERR']['topLevelRoot']);
        }

        return $value;
    }
public function onSaveType ( $ value , $ dc ) { if ( 'root' !== $ value && 'folder' !== $ value && $ dc -> activeRecord -> pid === 0 ) { throw new \ Exception ( $ GLOBALS [ 'TL_LANG' ] [ 'ERR' ] [ 'topLevelRoot' ] ) ; } return $ value ; }
Make sure that top-level pages are root pages or folders.

@param string                $value
@param \Contao\DataContainer $dc

@throws \Exception

@return string
Make sure that top - level pages are root pages or folders .