protected function save($varValue)
	{
		if (Input::post('FORM_SUBMIT') != $this->strTable)
		{
			return;
		}

		$arrData = $GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField];

		// Make sure that checkbox values are boolean
		if ($arrData['inputType'] == 'checkbox' && !$arrData['eval']['multiple'])
		{
			$varValue = $varValue ? true : false;
		}

		if ($varValue != '')
		{
			// Convert binary UUIDs (see #6893)
			if ($arrData['inputType'] == 'fileTree')
			{
				$varValue = StringUtil::deserialize($varValue);

				if (!\is_array($varValue))
				{
					$varValue = StringUtil::binToUuid($varValue);
				}
				else
				{
					$varValue = serialize(array_map('StringUtil::binToUuid', $varValue));
				}
			}

			// Convert date formats into timestamps
			if ($varValue !== null && $varValue !== '' && \in_array($arrData['eval']['rgxp'], array('date', 'time', 'datim')))
			{
				$objDate = new Date($varValue, Date::getFormatFromRgxp($arrData['eval']['rgxp']));
				$varValue = $objDate->tstamp;
			}

			// Handle entities
			if ($arrData['inputType'] == 'text' || $arrData['inputType'] == 'textarea')
			{
				$varValue = StringUtil::deserialize($varValue);

				if (!\is_array($varValue))
				{
					$varValue = StringUtil::restoreBasicEntities($varValue);
				}
				else
				{
					$varValue = serialize(array_map('StringUtil::restoreBasicEntities', $varValue));
				}
			}
		}

		// Trigger the save_callback
		if (\is_array($arrData['save_callback']))
		{
			foreach ($arrData['save_callback'] as $callback)
			{
				if (\is_array($callback))
				{
					$this->import($callback[0]);
					$varValue = $this->{$callback[0]}->{$callback[1]}($varValue, $this);
				}
				elseif (\is_callable($callback))
				{
					$varValue = $callback($varValue, $this);
				}
			}
		}

		$strCurrent = $this->varValue;

		// Handle arrays and strings
		if (\is_array($strCurrent))
		{
			$strCurrent = serialize($strCurrent);
		}
		elseif (\is_string($strCurrent))
		{
			$strCurrent = html_entity_decode($this->varValue, ENT_QUOTES, Config::get('characterSet'));
		}

		// Save the value if there was no error
		if ((\strlen($varValue) || !$arrData['eval']['doNotSaveEmpty']) && $strCurrent != $varValue)
		{
			Config::persist($this->strField, $varValue);

			$deserialize = StringUtil::deserialize($varValue);
			$prior = \is_bool(Config::get($this->strField)) ? (Config::get($this->strField) ? 'true' : 'false') : Config::get($this->strField);

			// Add a log entry
			if (!\is_array(StringUtil::deserialize($prior)) && !\is_array($deserialize))
			{
				if ($arrData['inputType'] == 'password' || $arrData['inputType'] == 'textStore')
				{
					$this->log('The global configuration variable "'.$this->strField.'" has been changed', __METHOD__, TL_CONFIGURATION);
				}
				else
				{
					$this->log('The global configuration variable "'.$this->strField.'" has been changed from "'.$prior.'" to "'.$varValue.'"', __METHOD__, TL_CONFIGURATION);
				}
			}

			// Set the new value so the input field can show it
			$this->varValue = $deserialize;
			Config::set($this->strField, $deserialize);
		}
	}
protected function save($varValue)
	{
		if (Input::post('FORM_SUBMIT') != $this->strTable)
		{
			return;
		}

		$arrData = $GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField];

		
		if ($arrData['inputType'] == 'checkbox' && !$arrData['eval']['multiple'])
		{
			$varValue = $varValue ? true : false;
		}

		if ($varValue != '')
		{
			
			if ($arrData['inputType'] == 'fileTree')
			{
				$varValue = StringUtil::deserialize($varValue);

				if (!\is_array($varValue))
				{
					$varValue = StringUtil::binToUuid($varValue);
				}
				else
				{
					$varValue = serialize(array_map('StringUtil::binToUuid', $varValue));
				}
			}

			
			if ($varValue !== null && $varValue !== '' && \in_array($arrData['eval']['rgxp'], array('date', 'time', 'datim')))
			{
				$objDate = new Date($varValue, Date::getFormatFromRgxp($arrData['eval']['rgxp']));
				$varValue = $objDate->tstamp;
			}

			
			if ($arrData['inputType'] == 'text' || $arrData['inputType'] == 'textarea')
			{
				$varValue = StringUtil::deserialize($varValue);

				if (!\is_array($varValue))
				{
					$varValue = StringUtil::restoreBasicEntities($varValue);
				}
				else
				{
					$varValue = serialize(array_map('StringUtil::restoreBasicEntities', $varValue));
				}
			}
		}

		
		if (\is_array($arrData['save_callback']))
		{
			foreach ($arrData['save_callback'] as $callback)
			{
				if (\is_array($callback))
				{
					$this->import($callback[0]);
					$varValue = $this->{$callback[0]}->{$callback[1]}($varValue, $this);
				}
				elseif (\is_callable($callback))
				{
					$varValue = $callback($varValue, $this);
				}
			}
		}

		$strCurrent = $this->varValue;

		
		if (\is_array($strCurrent))
		{
			$strCurrent = serialize($strCurrent);
		}
		elseif (\is_string($strCurrent))
		{
			$strCurrent = html_entity_decode($this->varValue, ENT_QUOTES, Config::get('characterSet'));
		}

		
		if ((\strlen($varValue) || !$arrData['eval']['doNotSaveEmpty']) && $strCurrent != $varValue)
		{
			Config::persist($this->strField, $varValue);

			$deserialize = StringUtil::deserialize($varValue);
			$prior = \is_bool(Config::get($this->strField)) ? (Config::get($this->strField) ? 'true' : 'false') : Config::get($this->strField);

			
			if (!\is_array(StringUtil::deserialize($prior)) && !\is_array($deserialize))
			{
				if ($arrData['inputType'] == 'password' || $arrData['inputType'] == 'textStore')
				{
					$this->log('The global configuration variable "'.$this->strField.'" has been changed', __METHOD__, TL_CONFIGURATION);
				}
				else
				{
					$this->log('The global configuration variable "'.$this->strField.'" has been changed from "'.$prior.'" to "'.$varValue.'"', __METHOD__, TL_CONFIGURATION);
				}
			}

			
			$this->varValue = $deserialize;
			Config::set($this->strField, $deserialize);
		}
	}
protected function save ( $ varValue ) { if ( Input :: post ( 'FORM_SUBMIT' ) != $ this -> strTable ) { return ; } $ arrData = $ GLOBALS [ 'TL_DCA' ] [ $ this -> strTable ] [ 'fields' ] [ $ this -> strField ] ; // Make sure that checkbox values are boolean if ( $ arrData [ 'inputType' ] == 'checkbox' && ! $ arrData [ 'eval' ] [ 'multiple' ] ) { $ varValue = $ varValue ? true : false ; } if ( $ varValue != '' ) { // Convert binary UUIDs (see #6893) if ( $ arrData [ 'inputType' ] == 'fileTree' ) { $ varValue = StringUtil :: deserialize ( $ varValue ) ; if ( ! \ is_array ( $ varValue ) ) { $ varValue = StringUtil :: binToUuid ( $ varValue ) ; } else { $ varValue = serialize ( array_map ( 'StringUtil::binToUuid' , $ varValue ) ) ; } } // Convert date formats into timestamps if ( $ varValue !== null && $ varValue !== '' && \ in_array ( $ arrData [ 'eval' ] [ 'rgxp' ] , array ( 'date' , 'time' , 'datim' ) ) ) { $ objDate = new Date ( $ varValue , Date :: getFormatFromRgxp ( $ arrData [ 'eval' ] [ 'rgxp' ] ) ) ; $ varValue = $ objDate -> tstamp ; } // Handle entities if ( $ arrData [ 'inputType' ] == 'text' || $ arrData [ 'inputType' ] == 'textarea' ) { $ varValue = StringUtil :: deserialize ( $ varValue ) ; if ( ! \ is_array ( $ varValue ) ) { $ varValue = StringUtil :: restoreBasicEntities ( $ varValue ) ; } else { $ varValue = serialize ( array_map ( 'StringUtil::restoreBasicEntities' , $ varValue ) ) ; } } } // Trigger the save_callback if ( \ is_array ( $ arrData [ 'save_callback' ] ) ) { foreach ( $ arrData [ 'save_callback' ] as $ callback ) { if ( \ is_array ( $ callback ) ) { $ this -> import ( $ callback [ 0 ] ) ; $ varValue = $ this -> { $ callback [ 0 ] } -> { $ callback [ 1 ] } ( $ varValue , $ this ) ; } elseif ( \ is_callable ( $ callback ) ) { $ varValue = $ callback ( $ varValue , $ this ) ; } } } $ strCurrent = $ this -> varValue ; // Handle arrays and strings if ( \ is_array ( $ strCurrent ) ) { $ strCurrent = serialize ( $ strCurrent ) ; } elseif ( \ is_string ( $ strCurrent ) ) { $ strCurrent = html_entity_decode ( $ this -> varValue , ENT_QUOTES , Config :: get ( 'characterSet' ) ) ; } // Save the value if there was no error if ( ( \ strlen ( $ varValue ) || ! $ arrData [ 'eval' ] [ 'doNotSaveEmpty' ] ) && $ strCurrent != $ varValue ) { Config :: persist ( $ this -> strField , $ varValue ) ; $ deserialize = StringUtil :: deserialize ( $ varValue ) ; $ prior = \ is_bool ( Config :: get ( $ this -> strField ) ) ? ( Config :: get ( $ this -> strField ) ? 'true' : 'false' ) : Config :: get ( $ this -> strField ) ; // Add a log entry if ( ! \ is_array ( StringUtil :: deserialize ( $ prior ) ) && ! \ is_array ( $ deserialize ) ) { if ( $ arrData [ 'inputType' ] == 'password' || $ arrData [ 'inputType' ] == 'textStore' ) { $ this -> log ( 'The global configuration variable "' . $ this -> strField . '" has been changed' , __METHOD__ , TL_CONFIGURATION ) ; } else { $ this -> log ( 'The global configuration variable "' . $ this -> strField . '" has been changed from "' . $ prior . '" to "' . $ varValue . '"' , __METHOD__ , TL_CONFIGURATION ) ; } } // Set the new value so the input field can show it $ this -> varValue = $ deserialize ; Config :: set ( $ this -> strField , $ deserialize ) ; } }
Save the current value

@param mixed $varValue
Save the current value