news-bundle/src/Resources/contao/dca/tl_news.php
public function toggleFeatured($intId, $blnVisible, Contao\DataContainer $dc=null)
	{
		// Check permissions to edit
		Contao\Input::setGet('id', $intId);
		Contao\Input::setGet('act', 'feature');

		$this->checkPermission();

		// Check permissions to feature
		if (!$this->User->hasAccess('tl_news::featured', 'alexf'))
		{
			throw new Contao\CoreBundle\Exception\AccessDeniedException('Not enough permissions to feature/unfeature news item ID ' . $intId . '.');
		}

		$objVersions = new Contao\Versions('tl_news', $intId);
		$objVersions->initialize();

		// Trigger the save_callback
		if (\is_array($GLOBALS['TL_DCA']['tl_news']['fields']['featured']['save_callback']))
		{
			foreach ($GLOBALS['TL_DCA']['tl_news']['fields']['featured']['save_callback'] as $callback)
			{
				if (\is_array($callback))
				{
					$this->import($callback[0]);
					$blnVisible = $this->{$callback[0]}->{$callback[1]}($blnVisible, $dc);
				}
				elseif (\is_callable($callback))
				{
					$blnVisible = $callback($blnVisible, $this);
				}
			}
		}

		// Update the database
		$this->Database->prepare("UPDATE tl_news SET tstamp=". time() .", featured='" . ($blnVisible ? 1 : '') . "' WHERE id=?")
					   ->execute($intId);

		$objVersions->create();
	}
public function toggleFeatured($intId, $blnVisible, Contao\DataContainer $dc=null)
	{
		// Check permissions to edit
		Contao\Input::setGet('id', $intId);
		Contao\Input::setGet('act', 'feature');

		$this->checkPermission();

		// Check permissions to feature
		if (!$this->User->hasAccess('tl_news::featured', 'alexf'))
		{
			throw new Contao\CoreBundle\Exception\AccessDeniedException('Not enough permissions to feature/unfeature news item ID ' . $intId . '.');
		}

		$objVersions = new Contao\Versions('tl_news', $intId);
		$objVersions->initialize();

		// Trigger the save_callback
		if (\is_array($GLOBALS['TL_DCA']['tl_news']['fields']['featured']['save_callback']))
		{
			foreach ($GLOBALS['TL_DCA']['tl_news']['fields']['featured']['save_callback'] as $callback)
			{
				if (\is_array($callback))
				{
					$this->import($callback[0]);
					$blnVisible = $this->{$callback[0]}->{$callback[1]}($blnVisible, $dc);
				}
				elseif (\is_callable($callback))
				{
					$blnVisible = $callback($blnVisible, $this);
				}
			}
		}

		// Update the database
		$this->Database->prepare("UPDATE tl_news SET tstamp=". time() .", featured='" . ($blnVisible ? 1 : '') . "' WHERE id=?")
					   ->execute($intId);

		$objVersions->create();
	}
Feature/unfeature a news item

@param integer              $intId
@param boolean              $blnVisible
@param Contao\DataContainer $dc

@throws Contao\CoreBundle\Exception\AccessDeniedException