protected function createDca($dc, $type, $createFromPost = false, $tmpField = null)
	{
		$config = static::getConfigByType($type);

		if (!$config) {
			return;
		}

		$assetsDir = 'bundles/rocksolidcustomelements';

		if (TL_MODE === 'BE') {
			$GLOBALS['TL_JAVASCRIPT'][] = $assetsDir . '/js/be_main.js';
			$GLOBALS['TL_CSS'][] = $assetsDir . '/css/be_main.css';
		}

		$paletteFields = array();
		$standardFields = is_array($config['standardFields']) ? $config['standardFields'] : array();
		$this->fieldsConfig = $config['fields'];

		foreach ($this->fieldsConfig as $fieldName => $fieldConfig) {
			$this->createDcaItem('rsce_field_', $fieldName, $fieldConfig, $paletteFields, $dc, $createFromPost);
		}
		if ($tmpField && !in_array($tmpField, $paletteFields)) {
			$fieldConfig = $this->getNestedConfig($tmpField, $this->fieldsConfig);
			if ($fieldConfig) {
				$this->createDcaItem($tmpField, '', $fieldConfig, $paletteFields, $dc, false);
			}
		}

		$paletteFields[] = 'rsce_data';

		$GLOBALS['TL_DCA'][$dc->table]['palettes'][$type] = static::generatePalette(
			$dc->table,
			$paletteFields,
			$standardFields
		);

		$GLOBALS['TL_DCA'][$dc->table]['fields']['customTpl']['options_callback'] = function($dc) {
			$templates = \Controller::getTemplateGroup($dc->activeRecord->type);
			foreach ($templates as $key => $label) {
				if (substr($key, -7) === '_config' || $key === $dc->activeRecord->type) {
					unset($templates[$key]);
				}
			}
			return $templates;
		};

		$GLOBALS['TL_LANG'][$dc->table]['rsce_legend'] = $GLOBALS['TL_LANG'][$dc->table === 'tl_content' ? 'CTE' : ($dc->table === 'tl_module' ? 'FMD' : 'FFL')][$type][0];

		if ($config['onloadCallback'] && is_array($config['onloadCallback'])) {
			foreach ($config['onloadCallback'] as $callback) {
				if (is_array($callback)) {
					\System::importStatic($callback[0])->{$callback[1]}($dc);
				}
				else if (is_callable($callback)) {
					$callback($dc);
				}
			}
		}
	}