core-bundle/src/Resources/contao/classes/Theme.php
protected function addDataRow(\DOMDocument $xml, \DOMElement $table, array $arrRow, array $arrOrder=array())
	{
		$t = $table->getAttribute('name');

		$row = $xml->createElement('row');
		$row = $table->appendChild($row);

		foreach ($arrRow as $k=>$v)
		{
			$field = $xml->createElement('field');
			$field->setAttribute('name', $k);
			$field = $row->appendChild($field);

			if ($v === null)
			{
				$v = 'NULL';
			}

			// Replace the IDs of singleSRC fields with their path (see #4952)
			elseif ($GLOBALS['TL_DCA'][$t]['fields'][$k]['inputType'] == 'fileTree' && !$GLOBALS['TL_DCA'][$t]['fields'][$k]['eval']['multiple'])
			{
				$objFile = FilesModel::findByUuid($v);

				if ($objFile !== null)
				{
					$v = $this->standardizeUploadPath($objFile->path);
				}
				else
				{
					$v = 'NULL';
				}
			}

			// Replace the IDs of multiSRC fields with their paths (see #4952)
			elseif ($GLOBALS['TL_DCA'][$t]['fields'][$k]['inputType'] == 'fileTree' || \in_array($k, $arrOrder))
			{
				$arrFiles = StringUtil::deserialize($v);

				if (!empty($arrFiles) && \is_array($arrFiles))
				{
					$objFiles = FilesModel::findMultipleByUuids($arrFiles);

					if ($objFiles !== null)
					{
						$arrTmp = array();

						while ($objFiles->next())
						{
							$arrTmp[] = $this->standardizeUploadPath($objFiles->path);
						}

						$v = serialize($arrTmp);
					}
					else
					{
						$v = 'NULL';
					}
				}
			}
			elseif ($t == 'tl_style' && ($k == 'bgimage' || $k == 'liststyleimage'))
			{
				$v = $this->standardizeUploadPath($v);
			}

			$value = $xml->createTextNode($v);
			$field->appendChild($value);
		}
	}
protected function addDataRow(\DOMDocument $xml, \DOMElement $table, array $arrRow, array $arrOrder=array())
	{
		$t = $table->getAttribute('name');

		$row = $xml->createElement('row');
		$row = $table->appendChild($row);

		foreach ($arrRow as $k=>$v)
		{
			$field = $xml->createElement('field');
			$field->setAttribute('name', $k);
			$field = $row->appendChild($field);

			if ($v === null)
			{
				$v = 'NULL';
			}

			// Replace the IDs of singleSRC fields with their path (see #4952)
			elseif ($GLOBALS['TL_DCA'][$t]['fields'][$k]['inputType'] == 'fileTree' && !$GLOBALS['TL_DCA'][$t]['fields'][$k]['eval']['multiple'])
			{
				$objFile = FilesModel::findByUuid($v);

				if ($objFile !== null)
				{
					$v = $this->standardizeUploadPath($objFile->path);
				}
				else
				{
					$v = 'NULL';
				}
			}

			// Replace the IDs of multiSRC fields with their paths (see #4952)
			elseif ($GLOBALS['TL_DCA'][$t]['fields'][$k]['inputType'] == 'fileTree' || \in_array($k, $arrOrder))
			{
				$arrFiles = StringUtil::deserialize($v);

				if (!empty($arrFiles) && \is_array($arrFiles))
				{
					$objFiles = FilesModel::findMultipleByUuids($arrFiles);

					if ($objFiles !== null)
					{
						$arrTmp = array();

						while ($objFiles->next())
						{
							$arrTmp[] = $this->standardizeUploadPath($objFiles->path);
						}

						$v = serialize($arrTmp);
					}
					else
					{
						$v = 'NULL';
					}
				}
			}
			elseif ($t == 'tl_style' && ($k == 'bgimage' || $k == 'liststyleimage'))
			{
				$v = $this->standardizeUploadPath($v);
			}

			$value = $xml->createTextNode($v);
			$field->appendChild($value);
		}
	}
protected function addDataRow ( \ DOMDocument $ xml , \ DOMElement $ table , array $ arrRow , array $ arrOrder = array ( ) ) { $ t = $ table -> getAttribute ( 'name' ) ; $ row = $ xml -> createElement ( 'row' ) ; $ row = $ table -> appendChild ( $ row ) ; foreach ( $ arrRow as $ k => $ v ) { $ field = $ xml -> createElement ( 'field' ) ; $ field -> setAttribute ( 'name' , $ k ) ; $ field = $ row -> appendChild ( $ field ) ; if ( $ v === null ) { $ v = 'NULL' ; } // Replace the IDs of singleSRC fields with their path (see #4952) elseif ( $ GLOBALS [ 'TL_DCA' ] [ $ t ] [ 'fields' ] [ $ k ] [ 'inputType' ] == 'fileTree' && ! $ GLOBALS [ 'TL_DCA' ] [ $ t ] [ 'fields' ] [ $ k ] [ 'eval' ] [ 'multiple' ] ) { $ objFile = FilesModel :: findByUuid ( $ v ) ; if ( $ objFile !== null ) { $ v = $ this -> standardizeUploadPath ( $ objFile -> path ) ; } else { $ v = 'NULL' ; } } // Replace the IDs of multiSRC fields with their paths (see #4952) elseif ( $ GLOBALS [ 'TL_DCA' ] [ $ t ] [ 'fields' ] [ $ k ] [ 'inputType' ] == 'fileTree' || \ in_array ( $ k , $ arrOrder ) ) { $ arrFiles = StringUtil :: deserialize ( $ v ) ; if ( ! empty ( $ arrFiles ) && \ is_array ( $ arrFiles ) ) { $ objFiles = FilesModel :: findMultipleByUuids ( $ arrFiles ) ; if ( $ objFiles !== null ) { $ arrTmp = array ( ) ; while ( $ objFiles -> next ( ) ) { $ arrTmp [ ] = $ this -> standardizeUploadPath ( $ objFiles -> path ) ; } $ v = serialize ( $ arrTmp ) ; } else { $ v = 'NULL' ; } } } elseif ( $ t == 'tl_style' && ( $ k == 'bgimage' || $ k == 'liststyleimage' ) ) { $ v = $ this -> standardizeUploadPath ( $ v ) ; } $ value = $ xml -> createTextNode ( $ v ) ; $ field -> appendChild ( $ value ) ; } }
Add a data row to the XML document
@param \DOMDocument         $xml
@param \DOMNode|\DOMElement $table
@param array                $arrRow
@param array                $arrOrder
Add a data row to the XML document