public function generateDCA($strFieldName, $arrFieldDCA=array(), $bolVisble=true, $bolCallbacks=true)
	{
		$strVirtualField = $this->virtualFieldName($strFieldName);
		
		// Add to palette
		if ($bolVisble)
		{
/*			Using the subpalette system of the DC_TABLE not possible because of direct database check 
			(see https://github.com/contao/core-bundle/blob/2a85914f4ba858780ffbac38a468acb7028772c7/src/Resources/contao/drivers/DC_Table.php#L3191)

			if (!empty($this->parent))
			{
				if (isset($GLOBALS['TL_DCA']['tl_content']['subpalettes'][$this->parent]))
				{
					$GLOBALS['TL_DCA']['tl_content']['subpalettes'][$this->parent] .= ',' . $strVirtualField;	
				}
				else
				{
					$GLOBALS['TL_DCA']['tl_content']['palettes']['__selector__'][] = $this->parent;	
					$GLOBALS['TL_DCA']['tl_content']['subpalettes'][$this->parent] = $strVirtualField;	
				}
			}
			else
			{
				$GLOBALS['TL_DCA']['tl_content']['palettes'][$this->alias] .= ',' . $strVirtualField;	
			}
*/			

			$GLOBALS['TL_DCA']['tl_content']['palettes'][$this->element] .= ',' . $strVirtualField;	
		}

		// Add necessary virtual field callbacks
		if ($bolCallbacks)
		{
			$arrFieldDCA['eval']['doNotSaveEmpty'] = true;
			
			$arrFieldDCA['load_callback'] = is_array($arrFieldDCA['load_callback']) ? $arrFieldDCA['load_callback'] : array();
			$arrFieldDCA['save_callback'] = is_array($arrFieldDCA['save_callback']) ? $arrFieldDCA['save_callback'] : array();
			
			// load default value
			if ($arrFieldDCA['default'])
			{
				array_unshift($arrFieldDCA['load_callback'], array('tl_content_elements', 'defaultValue'));
			}

			// load/save database values first/last
			array_unshift($arrFieldDCA['load_callback'], array('tl_content_elements', 'loadFieldValue'));
			array_push($arrFieldDCA['save_callback'], array('tl_content_elements', 'saveFieldAndClear'));
		}
		
		// Virtual field data
		$arrFieldDCA = array_merge($arrFieldDCA, array
		(
			'id' 		=> (isset($this->data->id)) ? $this->data->id : null,
			'pattern' 	=> $this->pattern,
			'parent'	=> (isset($this->parent)) ? $this->parent : 0,
			'column' 	=> $strFieldName,
			'data'		=> (isset($this->data->$strFieldName)) ? $this->data->$strFieldName : null
		));

		// Add field informations
		$GLOBALS['TL_DCA']['tl_content']['fields'][$strVirtualField] = $arrFieldDCA;
	}
public function generateDCA($strFieldName, $arrFieldDCA=array(), $bolVisble=true, $bolCallbacks=true)
	{
		$strVirtualField = $this->virtualFieldName($strFieldName);
		
		// Add to palette
		if ($bolVisble)
		{
/*			Using the subpalette system of the DC_TABLE not possible because of direct database check 
			(see https://github.com/contao/core-bundle/blob/2a85914f4ba858780ffbac38a468acb7028772c7/src/Resources/contao/drivers/DC_Table.php#L3191)

			if (!empty($this->parent))
			{
				if (isset($GLOBALS['TL_DCA']['tl_content']['subpalettes'][$this->parent]))
				{
					$GLOBALS['TL_DCA']['tl_content']['subpalettes'][$this->parent] .= ',' . $strVirtualField;	
				}
				else
				{
					$GLOBALS['TL_DCA']['tl_content']['palettes']['__selector__'][] = $this->parent;	
					$GLOBALS['TL_DCA']['tl_content']['subpalettes'][$this->parent] = $strVirtualField;	
				}
			}
			else
			{
				$GLOBALS['TL_DCA']['tl_content']['palettes'][$this->alias] .= ',' . $strVirtualField;	
			}
*/			

			$GLOBALS['TL_DCA']['tl_content']['palettes'][$this->element] .= ',' . $strVirtualField;	
		}

		// Add necessary virtual field callbacks
		if ($bolCallbacks)
		{
			$arrFieldDCA['eval']['doNotSaveEmpty'] = true;
			
			$arrFieldDCA['load_callback'] = is_array($arrFieldDCA['load_callback']) ? $arrFieldDCA['load_callback'] : array();
			$arrFieldDCA['save_callback'] = is_array($arrFieldDCA['save_callback']) ? $arrFieldDCA['save_callback'] : array();
			
			// load default value
			if ($arrFieldDCA['default'])
			{
				array_unshift($arrFieldDCA['load_callback'], array('tl_content_elements', 'defaultValue'));
			}

			// load/save database values first/last
			array_unshift($arrFieldDCA['load_callback'], array('tl_content_elements', 'loadFieldValue'));
			array_push($arrFieldDCA['save_callback'], array('tl_content_elements', 'saveFieldAndClear'));
		}
		
		// Virtual field data
		$arrFieldDCA = array_merge($arrFieldDCA, array
		(
			'id' 		=> (isset($this->data->id)) ? $this->data->id : null,
			'pattern' 	=> $this->pattern,
			'parent'	=> (isset($this->parent)) ? $this->parent : 0,
			'column' 	=> $strFieldName,
			'data'		=> (isset($this->data->$strFieldName)) ? $this->data->$strFieldName : null
		));

		// Add field informations
		$GLOBALS['TL_DCA']['tl_content']['fields'][$strVirtualField] = $arrFieldDCA;
	}
public function generateDCA ( $ strFieldName , $ arrFieldDCA = array ( ) , $ bolVisble = true , $ bolCallbacks = true ) { $ strVirtualField = $ this -> virtualFieldName ( $ strFieldName ) ; // Add to palette if ( $ bolVisble ) { /*			Using the subpalette system of the DC_TABLE not possible because of direct database check 
			(see https://github.com/contao/core-bundle/blob/2a85914f4ba858780ffbac38a468acb7028772c7/src/Resources/contao/drivers/DC_Table.php#L3191)

			if (!empty($this->parent))
			{
				if (isset($GLOBALS['TL_DCA']['tl_content']['subpalettes'][$this->parent]))
				{
					$GLOBALS['TL_DCA']['tl_content']['subpalettes'][$this->parent] .= ',' . $strVirtualField;	
				}
				else
				{
					$GLOBALS['TL_DCA']['tl_content']['palettes']['__selector__'][] = $this->parent;	
					$GLOBALS['TL_DCA']['tl_content']['subpalettes'][$this->parent] = $strVirtualField;	
				}
			}
			else
			{
				$GLOBALS['TL_DCA']['tl_content']['palettes'][$this->alias] .= ',' . $strVirtualField;	
			}
*/ $ GLOBALS [ 'TL_DCA' ] [ 'tl_content' ] [ 'palettes' ] [ $ this -> element ] .= ',' . $ strVirtualField ; } // Add necessary virtual field callbacks if ( $ bolCallbacks ) { $ arrFieldDCA [ 'eval' ] [ 'doNotSaveEmpty' ] = true ; $ arrFieldDCA [ 'load_callback' ] = is_array ( $ arrFieldDCA [ 'load_callback' ] ) ? $ arrFieldDCA [ 'load_callback' ] : array ( ) ; $ arrFieldDCA [ 'save_callback' ] = is_array ( $ arrFieldDCA [ 'save_callback' ] ) ? $ arrFieldDCA [ 'save_callback' ] : array ( ) ; // load default value if ( $ arrFieldDCA [ 'default' ] ) { array_unshift ( $ arrFieldDCA [ 'load_callback' ] , array ( 'tl_content_elements' , 'defaultValue' ) ) ; } // load/save database values first/last array_unshift ( $ arrFieldDCA [ 'load_callback' ] , array ( 'tl_content_elements' , 'loadFieldValue' ) ) ; array_push ( $ arrFieldDCA [ 'save_callback' ] , array ( 'tl_content_elements' , 'saveFieldAndClear' ) ) ; } // Virtual field data $ arrFieldDCA = array_merge ( $ arrFieldDCA , array ( 'id' => ( isset ( $ this -> data -> id ) ) ? $ this -> data -> id : null , 'pattern' => $ this -> pattern , 'parent' => ( isset ( $ this -> parent ) ) ? $ this -> parent : 0 , 'column' => $ strFieldName , 'data' => ( isset ( $ this -> data -> $ strFieldName ) ) ? $ this -> data -> $ strFieldName : null ) ) ; // Add field informations $ GLOBALS [ 'TL_DCA' ] [ 'tl_content' ] [ 'fields' ] [ $ strVirtualField ] = $ arrFieldDCA ; }
Generate the DCA for a virtual input field

@param string  $strFieldName The input field name
@param array   $arrFieldDCA  The input field DCA array
@param boolean $bolVisble    Make the input field visible
@param boolean $bolCallbacks Set callbacks for the input field
Generate the DCA for a virtual input field