/**
  * @param $type
  * @param View $view
  *
  * @return string
  */
 public static function buildElementConfig($type, View $view)
 {
     $userConfigElements = array();
     $configNode = Config::getConfig()->{$type};
     if (!empty($configNode)) {
         $userConfigElements = $configNode->configElements->toArray();
     }
     if (empty($userConfigElements)) {
         $userConfigElements = array();
     }
     $coreConfigNode = array();
     $coreConfig = Config::getCoreConfig();
     if (isset($coreConfig->{$type}) && isset($coreConfig->{$type}->configElements)) {
         $coreConfigNode = $coreConfig->{$type}->configElements->toArray();
     }
     $configElements = array_merge($userConfigElements, $coreConfigNode);
     if (empty($configElements)) {
         return '';
     }
     $config = self::parseConfig($type, $configElements, $view);
     return $view->template('admin/fieldSet.php', array('configElements' => $config));
 }