public function setRootType(Contao\DataContainer $dc)
	{
		if (Contao\Input::get('act') != 'create')
		{
			return;
		}

		// Insert into
		if (Contao\Input::get('pid') == 0)
		{
			$GLOBALS['TL_DCA']['tl_page']['fields']['type']['default'] = 'root';
		}
		elseif (Contao\Input::get('mode') == 1)
		{
			$objPage = $this->Database->prepare("SELECT * FROM " . $dc->table . " WHERE id=?")
									  ->limit(1)
									  ->execute(Contao\Input::get('pid'));

			if ($objPage->pid == 0)
			{
				$GLOBALS['TL_DCA']['tl_page']['fields']['type']['default'] = 'root';
			}
		}
	}
public function setRootType(Contao\DataContainer $dc)
	{
		if (Contao\Input::get('act') != 'create')
		{
			return;
		}

		// Insert into
		if (Contao\Input::get('pid') == 0)
		{
			$GLOBALS['TL_DCA']['tl_page']['fields']['type']['default'] = 'root';
		}
		elseif (Contao\Input::get('mode') == 1)
		{
			$objPage = $this->Database->prepare("SELECT * FROM " . $dc->table . " WHERE id=?")
									  ->limit(1)
									  ->execute(Contao\Input::get('pid'));

			if ($objPage->pid == 0)
			{
				$GLOBALS['TL_DCA']['tl_page']['fields']['type']['default'] = 'root';
			}
		}
	}
public function setRootType ( Contao \ DataContainer $ dc ) { if ( Contao \ Input :: get ( 'act' ) != 'create' ) { return ; } // Insert into if ( Contao \ Input :: get ( 'pid' ) == 0 ) { $ GLOBALS [ 'TL_DCA' ] [ 'tl_page' ] [ 'fields' ] [ 'type' ] [ 'default' ] = 'root' ; } elseif ( Contao \ Input :: get ( 'mode' ) == 1 ) { $ objPage = $ this -> Database -> prepare ( "SELECT * FROM " . $ dc -> table . " WHERE id=?" ) -> limit ( 1 ) -> execute ( Contao \ Input :: get ( 'pid' ) ) ; if ( $ objPage -> pid == 0 ) { $ GLOBALS [ 'TL_DCA' ] [ 'tl_page' ] [ 'fields' ] [ 'type' ] [ 'default' ] = 'root' ; } } }
Make new top-level pages root pages

@param Contao\DataContainer $dc
Make new top - level pages root pages