Create the cookie bar template.

@param array  $data
@param string $name

@return FrontendTemplate
545673
public function createTemplate(array $data, $name = 'cookiebar')
    {
        $template = new FrontendTemplate($name);
        $this->setBasicData($template, $data);
        $this->setMoreLinkData($template, $data);
        $this->setAnalyticsCheckboxData($template, $data);

        // Cookie name
        $template->cookie = sprintf('COOKIEBAR_%s', $data['id']);

        return $template;
    }
1360018
public function create(string $name, string $data, array $labels = [], array $templating = [])
    {
        $request = array_filter([
            'Name' => $name,
            'Labels' => $labels,
            'Data' => $data,
            'Templating' => $templating,
        ]);

        $url = $this->url.'/create';

        return $this->curl->post($url, json_encode($request), $this->header);
    }
1018390
public function createPackage($name, array $data = array())
    {
        if (isset($this->packages[strtolower($name)])) {
            throw new \InvalidArgumentException(sprintf('The package "%s" already exists.', $name));
        }

        return $this->packages[strtolower($name)] = new PackageNode($name, $data);
    }
864008
public function createContentTypeGroup(
        ?ContentTypeGroupCreateData $data = null,
        ?string $name = null
    ): FormInterface {
        $name = $name ?: StringUtil::fqcnToBlockPrefix(ContentTypeGroupCreateType::class);

        return $this->formFactory->createNamed(
            $name,
            ContentTypeGroupCreateType::class,
            $data ?? new ContentTypeGroupCreateData()
        );
    }
196824
public function format($name, array $data) {
        $name = $this->_getTemplateName($name, $data);
        return parent::format($name, $data);
    }
620836
public function createFromImportedData($name, $data)
    {
        $class = new GroupClass($name);
        foreach ($data as $parameterName => $parameterData) {
            $class->addParameter($this->getGroupParameterFactory()->createFromImportedData($parameterName, $parameterData));
        }
        return $class;
    }
291632
protected function _elementCache($name, $data, $options)
    {
        if (isset($options['cache']['key'], $options['cache']['config'])) {
            $cache = $options['cache'];
            $cache['key'] = 'element_' . $cache['key'];

            return $cache;
        }

        $plugin = null;
        list($plugin, $name) = $this->pluginSplit($name);

        $underscored = null;
        if ($plugin) {
            $underscored = Inflector::underscore($plugin);
        }

        $cache = $options['cache'];
        unset($options['cache'], $options['callbacks'], $options['plugin']);
        $keys = array_merge(
            [$underscored, $name],
            array_keys($options),
            array_keys($data)
        );
        $config = [
            'config' => $this->elementCache,
            'key' => implode('_', $keys)
        ];
        if (is_array($cache)) {
            $defaults = [
                'config' => $this->elementCache,
                'key' => $config['key']
            ];
            $config = $cache + $defaults;
        }
        $config['key'] = 'element_' . $config['key'];

        return $config;
    }
645897
public function layout($name, array $data = [])
    {
        $this->layoutName = $name;
        $this->layoutData = $data;
        $this->engine->getProject()->get('file_layout_cache')->merge([$this->file->getUid() => [$this->layoutName]]);
    }
258286
private function setMoreLinkData(FrontendTemplate $template, array $data)
    {
        $template->more = null;

        if ($data['cookiebar_url']) {
            $template->more = [
                'label' => $data['cookiebar_link'] ?: $GLOBALS['TL_LANG']['MSC']['cookiebar.more'],
                'url' => $data['cookiebar_url'],
            ];
        }
    }
909478
private function _createObjectFromData($name, $data)
    {
        try {
            $cls = new $name();
            foreach ($data as $key => $value) {
                if ($name !== 'stdClass' && !array_key_exists(strtolower($key), get_object_vars($cls))) {
                    var_dump(get_object_vars($cls));
                    continue;
                }
                $key = strtolower($key);
                $cls->$key = $value;
            }
            return $cls;
        } catch (\Exception $e) {
            return null;
        }
    }
1346774
public function addCustomUrl(
        CustomUrlAddData $data = null,
        ?string $name = null
    ): FormInterface {
        $name = $name ?: StringUtil::fqcnToBlockPrefix(CustomUrlAddType::class);

        return $this->formFactory->createNamed($name, CustomUrlAddType::class, $data ?? new CustomUrlAddData());
    }
1028543
public static function make($name, $data = null, $nest = null)
    {
        self::$view = new Views();

        return self::$view->call($name, $data, $nest);
    }
959076
public static function newInstance($name, $data = null)
  {
    if (!is_array($data)) {
      $data = array();
    }

    $config = self::getInstance($name);
    $config->_data = $data;

    return $config;
  }
440104
public function render($name, $data = null)
  {
    $t = $this->template($name, $data);

    return $t->render();
  }
1105939
protected function _getTemplateName($name, array &$data = []) {
        if (isset($this->_callbacks[$name])) {
            $data = call_user_func($this->_callbacks[$name], $data);
        }
        if ($this->_callback) {
            $data = call_user_func($this->_callback, $name, $data);
        }
        if (isset($data['templateName'])) {
            $name = $data['templateName'];
            unset($data['templateName']);
        }
        return $name;
    }
1329458
public function format($name, array $data) {
        if (!isset($this->_compiled[$name])) {
            throw new RuntimeException("Cannot find template named '$name'.");
        }
        list($template, $placeholders) = $this->_compiled[$name];
        // If there is a {{attrs.xxxx}} block in $template, remove the xxxx attribute
        // from $data['attrs'] and add its content to $data['attrs.class'].
        if (isset($data['attrs'])) {
            foreach ($placeholders as $placeholder) {
                if (substr($placeholder, 0, 6) == 'attrs.'
                    && preg_match('#'.substr($placeholder, 6).'="([^"]*)"#',
                                  $data['attrs'], $matches) > 0) {
                    $data['attrs'] = preg_replace('#'.substr($placeholder, 6).'="[^"]*"#',
                                                  '', $data['attrs']);
                    $data[$placeholder] = trim($matches[1]);
                    if ($data[$placeholder]) {
                        $data[$placeholder] = ' '.$data[$placeholder];
                    }
                }
            }
            $data['attrs'] = trim($data['attrs']);
            if ($data['attrs']) {
                $data['attrs'] = ' '.$data['attrs'];
            }
        }
        return parent::format($name, $data);
    }
21361
public function addBlock($name, array $data)
    {
        if(!isset($this->__blocks[$name])) {
            $this->__blocks[$name] = array();
        }

        $this->__blocks[$name][] = $data;

        return $this;
    }