Contao\DC_Folder::create PHP Method

create() public method

Create a new folder
public create ( )
    public function create()
    {
        if ($GLOBALS['TL_DCA'][$this->strTable]['config']['notCreatable']) {
            throw new InternalServerErrorException('Table "' . $this->strTable . '" is not creatable.');
        }
        $this->import('Files');
        $strFolder = \Input::get('pid', true);
        if ($strFolder == '' || !file_exists(TL_ROOT . '/' . $strFolder) || !$this->isMounted($strFolder)) {
            throw new AccessDeniedException('Folder "' . $strFolder . '" is not mounted or is not a directory.');
        }
        /** @var SessionInterface $objSession */
        $objSession = \System::getContainer()->get('session');
        // Empty clipboard
        $arrClipboard = $objSession->get('CLIPBOARD');
        $arrClipboard[$this->strTable] = array();
        $objSession->set('CLIPBOARD', $arrClipboard);
        $this->Files->mkdir($strFolder . '/__new__');
        $this->redirect(html_entity_decode($this->switchToEdit($this->urlEncode($strFolder) . '/__new__')));
    }