core-bundle/src/Resources/contao/dca/tl_style.php
public function checkCategory($varValue)
	{
		// Do not change the value if it has been set already
		if (\strlen($varValue) || Contao\Input::post('FORM_SUBMIT') == 'tl_style')
		{
			return $varValue;
		}

		/** @var Symfony\Component\HttpFoundation\Session\Attribute\AttributeBagInterface $objSessionBag */
		$objSessionBag = Contao\System::getContainer()->get('session')->getBag('contao_backend');

		$key = 'tl_style_' . CURRENT_ID;
		$filter = $objSessionBag->get('filter');

		// Return the current category
		if (\strlen($filter[$key]['category']))
		{
			return $filter[$key]['category'];
		}

		return '';
	}
public function checkCategory($varValue)
	{
		// Do not change the value if it has been set already
		if (\strlen($varValue) || Contao\Input::post('FORM_SUBMIT') == 'tl_style')
		{
			return $varValue;
		}

		/** @var Symfony\Component\HttpFoundation\Session\Attribute\AttributeBagInterface $objSessionBag */
		$objSessionBag = Contao\System::getContainer()->get('session')->getBag('contao_backend');

		$key = 'tl_style_' . CURRENT_ID;
		$filter = $objSessionBag->get('filter');

		// Return the current category
		if (\strlen($filter[$key]['category']))
		{
			return $filter[$key]['category'];
		}

		return '';
	}
public function checkCategory ( $ varValue ) { // Do not change the value if it has been set already if ( \ strlen ( $ varValue ) || Contao \ Input :: post ( 'FORM_SUBMIT' ) == 'tl_style' ) { return $ varValue ; } /** @var Symfony\Component\HttpFoundation\Session\Attribute\AttributeBagInterface $objSessionBag */ $ objSessionBag = Contao \ System :: getContainer ( ) -> get ( 'session' ) -> getBag ( 'contao_backend' ) ; $ key = 'tl_style_' . CURRENT_ID ; $ filter = $ objSessionBag -> get ( 'filter' ) ; // Return the current category if ( \ strlen ( $ filter [ $ key ] [ 'category' ] ) ) { return $ filter [ $ key ] [ 'category' ] ; } return '' ; }
Automatically set the category if not set

@param mixed $varValue

@return string
Automatically set the category if not set