core-bundle/src/Resources/contao/classes/Backend.php
public static function addFileMetaInformationToRequest($strUuid, $strPtable, $intPid)
	{
		@trigger_error('Using Backend::addFileMetaInformationToRequest() has been deprecated and will no longer work in Contao 5.0.', E_USER_DEPRECATED);

		$objFile = FilesModel::findByUuid($strUuid);

		if ($objFile === null)
		{
			return;
		}

		$arrMeta = StringUtil::deserialize($objFile->meta);

		if (empty($arrMeta))
		{
			return;
		}

		$objPage = null;

		if ($strPtable == 'tl_article')
		{
			$objPage = PageModel::findOneBy(array('tl_page.id=(SELECT pid FROM tl_article WHERE id=?)'), $intPid);
		}
		else
		{
			// HOOK: support custom modules
			if (isset($GLOBALS['TL_HOOKS']['addFileMetaInformationToRequest']) && \is_array($GLOBALS['TL_HOOKS']['addFileMetaInformationToRequest']))
			{
				foreach ($GLOBALS['TL_HOOKS']['addFileMetaInformationToRequest'] as $callback)
				{
					if (($val = System::importStatic($callback[0])->{$callback[1]}($strPtable, $intPid)) !== false)
					{
						$objPage = $val;
					}
				}

				if ($objPage instanceof Result && $objPage->numRows < 1)
				{
					return;
				}

				if (\is_object($objPage) && !($objPage instanceof PageModel))
				{
					$objPage = PageModel::findByPk($objPage->id);
				}
			}
		}

		if ($objPage === null)
		{
			return;
		}

		$objPage->loadDetails();

		// Convert the language to a locale (see #5678)
		$strLanguage = str_replace('-', '_', $objPage->rootLanguage);

		if (isset($arrMeta[$strLanguage]))
		{
			if (!empty($arrMeta[$strLanguage]['title']) && Input::post('title') == '')
			{
				Input::setPost('title', $arrMeta[$strLanguage]['title']);
			}

			if (!empty($arrMeta[$strLanguage]['alt']) && Input::post('alt') == '')
			{
				Input::setPost('alt', $arrMeta[$strLanguage]['alt']);
			}

			if (!empty($arrMeta[$strLanguage]['caption']) && Input::post('caption') == '')
			{
				Input::setPost('caption', $arrMeta[$strLanguage]['caption']);
			}
		}
	}
public static function addFileMetaInformationToRequest($strUuid, $strPtable, $intPid)
	{
		@trigger_error('Using Backend::addFileMetaInformationToRequest() has been deprecated and will no longer work in Contao 5.0.', E_USER_DEPRECATED);

		$objFile = FilesModel::findByUuid($strUuid);

		if ($objFile === null)
		{
			return;
		}

		$arrMeta = StringUtil::deserialize($objFile->meta);

		if (empty($arrMeta))
		{
			return;
		}

		$objPage = null;

		if ($strPtable == 'tl_article')
		{
			$objPage = PageModel::findOneBy(array('tl_page.id=(SELECT pid FROM tl_article WHERE id=?)'), $intPid);
		}
		else
		{
			// HOOK: support custom modules
			if (isset($GLOBALS['TL_HOOKS']['addFileMetaInformationToRequest']) && \is_array($GLOBALS['TL_HOOKS']['addFileMetaInformationToRequest']))
			{
				foreach ($GLOBALS['TL_HOOKS']['addFileMetaInformationToRequest'] as $callback)
				{
					if (($val = System::importStatic($callback[0])->{$callback[1]}($strPtable, $intPid)) !== false)
					{
						$objPage = $val;
					}
				}

				if ($objPage instanceof Result && $objPage->numRows < 1)
				{
					return;
				}

				if (\is_object($objPage) && !($objPage instanceof PageModel))
				{
					$objPage = PageModel::findByPk($objPage->id);
				}
			}
		}

		if ($objPage === null)
		{
			return;
		}

		$objPage->loadDetails();

		// Convert the language to a locale (see #5678)
		$strLanguage = str_replace('-', '_', $objPage->rootLanguage);

		if (isset($arrMeta[$strLanguage]))
		{
			if (!empty($arrMeta[$strLanguage]['title']) && Input::post('title') == '')
			{
				Input::setPost('title', $arrMeta[$strLanguage]['title']);
			}

			if (!empty($arrMeta[$strLanguage]['alt']) && Input::post('alt') == '')
			{
				Input::setPost('alt', $arrMeta[$strLanguage]['alt']);
			}

			if (!empty($arrMeta[$strLanguage]['caption']) && Input::post('caption') == '')
			{
				Input::setPost('caption', $arrMeta[$strLanguage]['caption']);
			}
		}
	}
public static function addFileMetaInformationToRequest ( $ strUuid , $ strPtable , $ intPid ) { @ trigger_error ( 'Using Backend::addFileMetaInformationToRequest() has been deprecated and will no longer work in Contao 5.0.' , E_USER_DEPRECATED ) ; $ objFile = FilesModel :: findByUuid ( $ strUuid ) ; if ( $ objFile === null ) { return ; } $ arrMeta = StringUtil :: deserialize ( $ objFile -> meta ) ; if ( empty ( $ arrMeta ) ) { return ; } $ objPage = null ; if ( $ strPtable == 'tl_article' ) { $ objPage = PageModel :: findOneBy ( array ( 'tl_page.id=(SELECT pid FROM tl_article WHERE id=?)' ) , $ intPid ) ; } else { // HOOK: support custom modules if ( isset ( $ GLOBALS [ 'TL_HOOKS' ] [ 'addFileMetaInformationToRequest' ] ) && \ is_array ( $ GLOBALS [ 'TL_HOOKS' ] [ 'addFileMetaInformationToRequest' ] ) ) { foreach ( $ GLOBALS [ 'TL_HOOKS' ] [ 'addFileMetaInformationToRequest' ] as $ callback ) { if ( ( $ val = System :: importStatic ( $ callback [ 0 ] ) -> { $ callback [ 1 ] } ( $ strPtable , $ intPid ) ) !== false ) { $ objPage = $ val ; } } if ( $ objPage instanceof Result && $ objPage -> numRows < 1 ) { return ; } if ( \ is_object ( $ objPage ) && ! ( $ objPage instanceof PageModel ) ) { $ objPage = PageModel :: findByPk ( $ objPage -> id ) ; } } } if ( $ objPage === null ) { return ; } $ objPage -> loadDetails ( ) ; // Convert the language to a locale (see #5678) $ strLanguage = str_replace ( '-' , '_' , $ objPage -> rootLanguage ) ; if ( isset ( $ arrMeta [ $ strLanguage ] ) ) { if ( ! empty ( $ arrMeta [ $ strLanguage ] [ 'title' ] ) && Input :: post ( 'title' ) == '' ) { Input :: setPost ( 'title' , $ arrMeta [ $ strLanguage ] [ 'title' ] ) ; } if ( ! empty ( $ arrMeta [ $ strLanguage ] [ 'alt' ] ) && Input :: post ( 'alt' ) == '' ) { Input :: setPost ( 'alt' , $ arrMeta [ $ strLanguage ] [ 'alt' ] ) ; } if ( ! empty ( $ arrMeta [ $ strLanguage ] [ 'caption' ] ) && Input :: post ( 'caption' ) == '' ) { Input :: setPost ( 'caption' , $ arrMeta [ $ strLanguage ] [ 'caption' ] ) ; } } }
Add the file meta information to the request

@param string  $strUuid
@param string  $strPtable
@param integer $intPid

@deprecated Deprecated since Contao 4.4, to be removed in Contao 5.0.
Add the file meta information to the request