core-bundle/src/Resources/contao/widgets/FileSelector.php
public function generateAjax($strFolder, $strField, $level, $mount=false)
	{
		if (!Environment::get('isAjaxRequest'))
		{
			return '';
		}

		$this->strField = $strField;
		$this->loadDataContainer($this->strTable);

		// Load the current values
		switch ($GLOBALS['TL_DCA'][$this->strTable]['config']['dataContainer'])
		{
			case 'File':
				if (Config::get($this->strField) != '')
				{
					$this->varValue = Config::get($this->strField);
				}
				break;

			case 'Table':
				$this->import(Database::class, 'Database');

				if (!$this->Database->fieldExists($this->strField, $this->strTable))
				{
					break;
				}

				$objField = $this->Database->prepare("SELECT " . Database::quoteIdentifier($this->strField) . " FROM " . $this->strTable . " WHERE id=?")
										   ->limit(1)
										   ->execute($this->strId);

				if ($objField->numRows)
				{
					$this->varValue = StringUtil::deserialize($objField->{$this->strField});
				}
				break;
		}

		$this->convertValuesToPaths();

		if ($this->extensions != '')
		{
			$this->arrValidFileTypes = StringUtil::trimsplit(',', $this->extensions);
		}

		return $this->renderFiletree(System::getContainer()->getParameter('kernel.project_dir') . '/' . $strFolder, ($level * 20), $mount, $this->isProtectedPath($strFolder));
	}
public function generateAjax($strFolder, $strField, $level, $mount=false)
	{
		if (!Environment::get('isAjaxRequest'))
		{
			return '';
		}

		$this->strField = $strField;
		$this->loadDataContainer($this->strTable);

		// Load the current values
		switch ($GLOBALS['TL_DCA'][$this->strTable]['config']['dataContainer'])
		{
			case 'File':
				if (Config::get($this->strField) != '')
				{
					$this->varValue = Config::get($this->strField);
				}
				break;

			case 'Table':
				$this->import(Database::class, 'Database');

				if (!$this->Database->fieldExists($this->strField, $this->strTable))
				{
					break;
				}

				$objField = $this->Database->prepare("SELECT " . Database::quoteIdentifier($this->strField) . " FROM " . $this->strTable . " WHERE id=?")
										   ->limit(1)
										   ->execute($this->strId);

				if ($objField->numRows)
				{
					$this->varValue = StringUtil::deserialize($objField->{$this->strField});
				}
				break;
		}

		$this->convertValuesToPaths();

		if ($this->extensions != '')
		{
			$this->arrValidFileTypes = StringUtil::trimsplit(',', $this->extensions);
		}

		return $this->renderFiletree(System::getContainer()->getParameter('kernel.project_dir') . '/' . $strFolder, ($level * 20), $mount, $this->isProtectedPath($strFolder));
	}
Generate a particular subpart of the file tree and return it as HTML string

@param integer $strFolder
@param string  $strField
@param integer $level
@param boolean $mount

@return string