public function saveData (&$dc)
	{
		// Save all modified values
		foreach ($this->arrModifiedData as $field => $value)
		{
			// Get virtual field attributes from DCA
			$id = $GLOBALS['TL_DCA']['tl_content']['fields'][$field]['id'];
			$pattern = $GLOBALS['TL_DCA']['tl_content']['fields'][$field]['pattern'];
			$parent = $GLOBALS['TL_DCA']['tl_content']['fields'][$field]['parent'];
			$column = $GLOBALS['TL_DCA']['tl_content']['fields'][$field]['column'];

			if ($id !== null)
			{
				$objData = \DataModel::findByPK($id);
			}
			else
			{
				$objData = \DataModel::findByPidAndPatternAndParent($dc->activeRecord->id, $pattern, $parent);
			}

			if ($objData === null)
			{
				// if no dataset exist make a new one
				$objData = new \DataModel();
				$objData->tstamp = time();
			}

			$objData->pid = $dc->activeRecord->id;
			$objData->pattern = $pattern;
			$objData->parent = $parent;
		
			if ($objData->$column != $value)
			{
				$dc->blnCreateNewVersion = true;
				$objData->$column = $value;
				$objData->tstamp = time();
			}

			$objData->save();
		}
	}
public function saveData (&$dc)
	{
		// Save all modified values
		foreach ($this->arrModifiedData as $field => $value)
		{
			// Get virtual field attributes from DCA
			$id = $GLOBALS['TL_DCA']['tl_content']['fields'][$field]['id'];
			$pattern = $GLOBALS['TL_DCA']['tl_content']['fields'][$field]['pattern'];
			$parent = $GLOBALS['TL_DCA']['tl_content']['fields'][$field]['parent'];
			$column = $GLOBALS['TL_DCA']['tl_content']['fields'][$field]['column'];

			if ($id !== null)
			{
				$objData = \DataModel::findByPK($id);
			}
			else
			{
				$objData = \DataModel::findByPidAndPatternAndParent($dc->activeRecord->id, $pattern, $parent);
			}

			if ($objData === null)
			{
				// if no dataset exist make a new one
				$objData = new \DataModel();
				$objData->tstamp = time();
			}

			$objData->pid = $dc->activeRecord->id;
			$objData->pattern = $pattern;
			$objData->parent = $parent;
		
			if ($objData->$column != $value)
			{
				$dc->blnCreateNewVersion = true;
				$objData->$column = $value;
				$objData->tstamp = time();
			}

			$objData->save();
		}
	}
public function saveData ( & $ dc ) { // Save all modified values foreach ( $ this -> arrModifiedData as $ field => $ value ) { // Get virtual field attributes from DCA $ id = $ GLOBALS [ 'TL_DCA' ] [ 'tl_content' ] [ 'fields' ] [ $ field ] [ 'id' ] ; $ pattern = $ GLOBALS [ 'TL_DCA' ] [ 'tl_content' ] [ 'fields' ] [ $ field ] [ 'pattern' ] ; $ parent = $ GLOBALS [ 'TL_DCA' ] [ 'tl_content' ] [ 'fields' ] [ $ field ] [ 'parent' ] ; $ column = $ GLOBALS [ 'TL_DCA' ] [ 'tl_content' ] [ 'fields' ] [ $ field ] [ 'column' ] ; if ( $ id !== null ) { $ objData = \ DataModel :: findByPK ( $ id ) ; } else { $ objData = \ DataModel :: findByPidAndPatternAndParent ( $ dc -> activeRecord -> id , $ pattern , $ parent ) ; } if ( $ objData === null ) { // if no dataset exist make a new one $ objData = new \ DataModel ( ) ; $ objData -> tstamp = time ( ) ; } $ objData -> pid = $ dc -> activeRecord -> id ; $ objData -> pattern = $ pattern ; $ objData -> parent = $ parent ; if ( $ objData -> $ column != $ value ) { $ dc -> blnCreateNewVersion = true ; $ objData -> $ column = $ value ; $ objData -> tstamp = time ( ) ; } $ objData -> save ( ) ; } }
Save the virtual field values into the tl_data table

@param DataContainer $dc
Save the virtual field values into the tl_data table