public function getElements ($dc)
	{
		if ($dc->activeRecord !== null)
		{
			$ptable =  $dc->activeRecord->ptable;
			$pid = $dc->activeRecord->pid;
		}
		else
		{
			// If no activeRecord try to use get parameters (submitted by the custom help wizard)
			$ptable =  \Input::get('ptable');
			$pid = \Input::get('pid');
		}

		// Try to find content block elements for the theme
		$objLayout = \LayoutModel::findById(\Agoat\CustomContentElementsBundle\Contao\Controller::getLayoutId($ptable, $pid));	
		$colElements = \ElementsModel::findPublishedByPid($objLayout->pid);

		$arrElements = array();
		$strGroup = 'cte';
		
		if ($colElements !== null)
		{
			foreach ($colElements as $objElement)
			{
				if ($objElement->type == 'group')
				{
					$strGroup = $objElement->alias;
				}
				else
				{
					$arrElements[$strGroup][] = $objElement->alias;	
				}
			}
		}
		
		// Add standard content elements
		if (!\Config::get('hideLegacyCTE'))
		{
			unset($GLOBALS['TL_CTE']['CTE']);
			
			foreach ($GLOBALS['TL_CTE'] as $k=>$v)
			{
				foreach (array_keys($v) as $kk)
				{
					$arrElements[$k][] = $kk;
				}
			}
		}

		// Legacy support
		if ($dc->value != '' && !in_array($dc->value, array_reduce($arrElements, 'array_merge', array())))
		{
			if (($objLegacy = \ElementsModel::findOneByAlias($dc->value)) === null && !array_key_exists($dc->value, $GLOBALS['TL_DCA']['tl_content']['palettes']))
			{
				$arrLegacy = array('deleted' => array ($dc->value));
			}
			else if ($objLegacy->invisible)
			{
				$arrLegacy = array('invisible' => array ($dc->value));
			}
			else
			{
				$arrLegacy = array('legacy' => array ($dc->value));
			}	
			
			// Add current at top of the list
			$arrElements = array_merge($arrLegacy, $arrElements);
		}

		return $arrElements;
	}