Extract the template configuration to be given to the Placeholder widget
@param {aria.pageEngine.CfgBeans:Placeholder} item
@param {aria.pageEngine.CfgBeans:PageDefinition} pageConfig
@return {aria.html.beans.TemplateCfg:Properties}
@protected
337947
function (item, pageConfig) {
            var templateCfg = {
                classpath : item.template
            };
            var args = item.args || [];
            var extraArg = {};
            if (item.contentId) {
                extraArg.contents = this._getPlaceholderContents(pageConfig, item.contentId);
            }
            args.push(extraArg);

            templateCfg.args = args;
            if (item.module) {
                var module = this._rootModule.getPageModule(this.currentPageId, item.module);
                templateCfg.moduleCtrl = module;
                this._modulesInPage.push(module);
            }
            if (item.data) {
                templateCfg.data = item.data;
            }
            return templateCfg;
        }
267104
function getTemplateConfig(pageId, attr) {
  const dom = getTemplateDOMById.call(this, pageId);
  let config = dom.getAttribute(attr);
  if ((attr === "ct-data-mode") && !config) {
    config = "standard";
  }
  return config;
}
833926
function (config) {
			
			var choice, position, that;
			
			// allow config not to be an object, just a value -> convert it in a standard config object
			if (!lang.isObject(config)) {
				config = { value: config };
			}
			
			choice = {
				value: config.value,
				label: lang.isString(config.label) ? config.label : "" + config.value,
				visible: true
			};
			
			// Create DOM <option> node
			choice.node = this.createChoiceNode(choice);
			
			// Get choice's position
			//   -> don't pass config.value to getChoicePosition !!!
			//     (we search position of existing choice, whereas config.value is a property of new choice to be created...)
			position = this.getChoicePosition({ position: config.position, label: config.before || config.after });
			
			if (position === -1) { //  (default is at the end)
				position = this.choicesList.length;
				
			} else if (lang.isString(config.after)) {
				// +1 to insert "after" position (not "at" position)
				position += 1;
			}
			
			
			// Insert choice in list at position
			this.choicesList.splice(position, 0, choice);
			
			// Append <option> node in DOM
			this.appendChoiceNode(choice.node, position);
			
			// Select new choice
			if (!!config.selected) {
				
				// setTimeout for IE6 (let time to create dom option)
				that = this;
				setTimeout(function () {
					that.setValue(choice.value);
				}, 0);
				
			}
			
			// Return generated choice
			return choice;
			
		}
48556
def render_placeholder(self, placeholder, parent_object=None, template_name=None, cachable=None, limit_parent_language=True, fallback_language=None):
        
        placeholder_name = get_placeholder_debug_name(placeholder)
        logger.debug("Rendering placeholder '%s'", placeholder_name)

        # Determine whether the placeholder can be cached.
        cachable = self._can_cache_merged_output(template_name, cachable)
        try_cache = cachable and self.may_cache_placeholders()
        logger.debug("- try_cache=%s cachable=%s template_name=%s", try_cache, cachable, template_name)

        if parent_object is None:
            # To support filtering the placeholders by parent language, the parent object needs to be known.
            # Fortunately, the PlaceholderFieldDescriptor makes sure this doesn't require an additional query.
            parent_object = placeholder.parent

        # Fetch the placeholder output from cache.
        language_code = get_parent_language_code(parent_object)
        cache_key = None
        output = None
        if try_cache:
            cache_key = get_placeholder_cache_key_for_parent(parent_object, placeholder.slot, language_code)
            output = cache.get(cache_key)
            if output:
                logger.debug("- fetched cached output")

        if output is None:
            # Get the items, and render them
            items, is_fallback = self._get_placeholder_items(placeholder, parent_object, limit_parent_language, fallback_language, try_cache)
            output = self.render_items(placeholder, items, parent_object, template_name, cachable)

            if is_fallback:
                # Caching fallbacks is not supported yet,
                # content could be rendered in a different gettext language domain.
                output.cacheable = False

            # Store the full-placeholder contents in the cache.
            if try_cache and output.cacheable:
                if output.cache_timeout is not DEFAULT_TIMEOUT:
                    # The timeout is based on the minimal timeout used in plugins.
                    cache.set(cache_key, output, output.cache_timeout)
                else:
                    # Don't want to mix into the default 0/None issue.
                    cache.set(cache_key, output)

        return output
824742
function getTemplates(config) {

  var templates = {};

  Object.keys(templatePaths).forEach(function(key) {
      if (config.templates && (config.templates[key] && config.templates[key] !== true)) {
        templates[key] = config.templates[key];
      } else {
        templates[key] = fs.readFileSync(__dirname + templatePaths[key], "utf-8");
      }
    });

  return templates;
}
939925
function (siteConfig) {
            var valid = this.isConfigValid(siteConfig, "aria.pageEngine.CfgBeans.Site", this.INVALID_SITE_CONFIGURATION);
            if (!valid) {
                return;
            }
            var helper = new ariaPageEngineUtilsSiteConfigHelper(siteConfig);
            this._siteConfigHelper = helper;

            // Initialization
            var appData = helper.getAppData();
            appData.menus = appData.menus || {};

            var initArgs = {
                appData : appData,
                pageEngine : this._wrapper
            };

            var rootModuleConfig = this._config.rootModule;
            if (rootModuleConfig) {
                var customControllerClasspath = rootModuleConfig.classpath;
                if (rootModuleConfig.initArgs) {
                    ariaUtilsJson.inject(initArgs, rootModuleConfig.initArgs);
                }
                var that = this;
                Aria.load({
                    classes : [customControllerClasspath],
                    oncomplete : function () {
                        if (Aria.getClassRef(customControllerClasspath).classDefinition.$extends !== "aria.pageEngine.SiteRootModule") {
                            that._errorCallback([that.INVALID_ROOTMODULE_PARENT]);
                            return;
                        }
                        that._createModuleCtrl(rootModuleConfig);
                    },
                    onerror : this._getErrorCallbackConfig([this.MISSING_DEPENDENCIES])
                });
            } else {
                this._createModuleCtrl({
                    classpath : "aria.pageEngine.SiteRootModule",
                    initArgs : initArgs
                });
            }

        }
742042
function (propertyName, newValue) {
            if (!this._cfg) {
                return;
            }
            if (propertyName === "items" && this._cfg.bind.hasOwnProperty(propertyName)) {
                var oldValue = this.getProperty(propertyName);
                this._cfg[propertyName] = newValue;
                this._onBoundPropertyChange(propertyName, newValue, oldValue);
            } else {
                this.$TemplateBasedWidget.setWidgetProperty.apply(this, arguments);
            }
        }
827000
def _placeholders_recursif(nodelist, plist, blist):
    """"""
    # I needed to do this lazy import to compile the documentation
    from django.template.loader_tags import BlockNode

    for node in nodelist:

        # extends node?
        if hasattr(node, 'parent_name'):
            _placeholders_recursif(node.get_parent(dummy_context).nodelist,
                                                        plist, blist)
        # include node?
        elif hasattr(node, 'template') and hasattr(node.template, 'nodelist'):
            _placeholders_recursif(node.template.nodelist, plist, blist)

        # Is it a placeholder?
        if hasattr(node, 'page') and hasattr(node, 'parsed') and \
                hasattr(node, 'as_varname') and hasattr(node, 'name'):
            already_in_plist = False
            for placeholder in plist:
                if placeholder.name == node.name:
                    already_in_plist = True
            if not already_in_plist:
                if len(blist):
                    node.found_in_block = blist[len(blist) - 1]
                plist.append(node)
            node.render(Context())

        for key in ('nodelist', 'nodelist_true', 'nodelist_false'):
            if isinstance(node, BlockNode):
                # delete placeholders found in a block of the same name
                offset = 0
                _plist = [(i, v) for i, v in enumerate(plist)]
                for index, pl in _plist:
                    if pl.found_in_block and \
                            pl.found_in_block.name == node.name \
                            and pl.found_in_block != node:
                        del plist[index - offset]
                        offset += 1
                blist.append(node)

            if hasattr(node, key):
                try:
                    _placeholders_recursif(getattr(node, key), plist, blist)
                except:
                    pass
            if isinstance(node, BlockNode):
                blist.pop()
1104057
def placeholder_data_view(self, request, id):
        
        # See: `fluent_pages.pagetypes.fluentpage.admin.FluentPageAdmin`.
        try:
            layout = models.Layout.objects.get(pk=id)
        except models.Layout.DoesNotExist:
            json = {'success': False, 'error': 'Layout not found'}
            status = 404
        else:
            placeholders = layout.get_placeholder_data()
            status = 200

            placeholders = [p.as_dict() for p in placeholders]

            # inject placeholder help text, if any is set
            for p in placeholders:
                try:
                    p['help_text'] = settings.FLUENT_CONTENTS_PLACEHOLDER_CONFIG.get(p['slot']).get('help_text')
                except AttributeError:
                    p['help_text'] = None

            json = {
                'id': layout.id,
                'title': layout.title,
                'placeholders': placeholders,
            }

        return JsonResponse(json, status=status)
1173400
function (placeholder, dependencies, lazy) {
            var modules = this._pageModules, refpath, moduleDesc, typeUtils = ariaUtilsType;
            if (!typeUtils.isObject(placeholder)) {
                return;
            }
            var isLazy = (placeholder.lazy);
            if ((lazy && !isLazy) || (!lazy && isLazy)) {
                return;
            }
            if ("module" in placeholder) {
                refpath = placeholder.module;
                if (refpath.match(/^common:/)) {
                    this._utils.addIfMissing(refpath.replace(/^common:/, ""), dependencies.modules.common);
                } else {
                    moduleDesc = modules[refpath];
                    if (moduleDesc) {
                        this._utils.addIfMissing(moduleDesc.classpath, dependencies.classes);
                        this._utils.addIfMissing(refpath, dependencies.modules.page);
                    }
                }
            }
            if ("template" in placeholder) {
                this._utils.addIfMissing(placeholder.template, dependencies.templates);
            }
            if ("css" in placeholder) {
                this._utils.wiseConcat(dependencies.css, placeholder.css);
            }
        }
99784
function(element) {

		var widget,
			raw_template = Lava.TemplateParser.parseRaw(Firestorm.Element.getOuterHTML(element)),
			raw_tag,
			config,
			constructor;

		if (Lava.schema.DEBUG && raw_template.length != 1) Lava.t();

		raw_tag = raw_template[0];
		config = Lava.parsers.Common.toWidget(raw_tag);
		config.is_extended = true;
		config['class'] = raw_tag.attributes['lava-app'];

		if (raw_tag.attributes.id) Firestorm.Element.removeProperty(element, 'id'); // needed for captureExistingElement

		constructor = Lava.ClassManager.getConstructor(config['class'] || 'Lava.widget.Standard', 'Lava.widget');
		if (Lava.schema.DEBUG && !constructor) Lava.t('Class not found: ' + config['class']);
		widget = /** @type {Lava.widget.Standard} */ new constructor(config);
		widget.injectIntoExistingElement(element);
		return widget;

	}
727176
function (args) {
            if (!this._pageConfigHelper) {
                this.$callback(args.cb);
                return;
            }
            var pageConfig = args.pageConfig, cfg = pageConfig.pageComposition, pageId = pageConfig.pageId;
            this.$raiseEvent({
                name : "beforePageTransition",
                from : this.currentPageId,
                to : pageId
            });
            this.currentPageId = pageId;
            this._pageConfigs[pageId] = pageConfig;
            var pageRequest = args.pageRequest;
            pageRequest.url = pageConfig.url;
            pageRequest.pageId = pageConfig.pageId;
            pageRequest.title = pageConfig.title;

            var json = ariaUtilsJson;
            json.setValue(this._data, "pageData", cfg.pageData);
            json.setValue(this._data, "pageInfo", pageRequest);

            var cfgTemplate = {
                classpath : cfg.template,
                div : this._getContainer(!pageConfig.animation),
                moduleCtrl : this._rootModule
            };

            this._modulesInPage = [];
            // if the div does not change, let's dispose the previous template first
            if (cfgTemplate.div == this._getContainer() && this._isTemplateLoaded) {
                Aria.disposeTemplate(this._getContainer());
            }
            Aria.loadTemplate(cfgTemplate, {
                fn : this._afterTemplateLoaded,
                scope : this,
                args : {
                    pageConfig : pageConfig,
                    cb : args.cb,
                    div : cfgTemplate.div,
                    pageRequest : pageRequest
                }
            });
        }
662957
function (tplCfg) {
            if (this._cfgOk) {
                var cfg = this._cfg;

                for (var i = 0, len = this.__inherithCfg.length; i < len; i += 1) {
                    var property = this.__inherithCfg[i];
                    if (!tplCfg.hasOwnProperty(property)) {
                        tplCfg[property] = cfg[property];
                    }
                }

                if (cfg.defaultTemplate) {
                    // allow the customization of the template:
                    tplCfg.defaultTemplate = cfg.defaultTemplate;
                }
                if (cfg.id) {
                    tplCfg.id = cfg.id + "_t_";
                }
                var tplWidget = this._tplWidget = new ariaWidgetsTemplate(tplCfg, this._context, this._lineNumber);
                var extraAttributes = this._extraAttributes;
                if (extraAttributes) {
                    tplWidget.addExtraAttributes(extraAttributes);
                }

                tplWidget.tplLoadCallback = {
                    fn : this._tplLoadCallback,
                    scope : this
                };
            }
        }
36639
function(config, widget, parent_view, template, properties) {

		var name,
			argument,
			constructor;

		this.guid = Lava.guid++;
		if (Lava.schema.DEBUG && config.id && !Lava.isValidId(config.id)) Lava.t();
		if ('id' in config) {
			this.id = config.id;
		}
		if ('label' in config) {
			this.label = config.label;
		}

		Lava.view_manager.registerView(this);

		this._config = config;
		this._widget = widget;
		this._template = template;

		if (parent_view) {

			this._parent_view = parent_view;
			this._parent_with_container = parent_view.getContainer() ? parent_view : parent_view.getParentWithContainer();
			this.depth = parent_view.depth + 1;

		}

		this._initMembers(properties);

		for (name in config.assigns) {

			if (config.assigns[name].once) {

				argument = new Lava.scope.Argument(config.assigns[name], this, this._widget);
				this.set(name, argument.getValue());
				argument.destroy();

			} else {

				if (name in this._property_bindings_by_property) Lava.t("Error initializing assign: property binding already created");

				this._property_bindings_by_property[name] = new Lava.scope.PropertyBinding(this, name, config.assigns[name]);

			}

		}

		if ('container' in config) {

			constructor = Lava.ClassManager.getConstructor(config.container['type'], 'Lava.view.container');
			this._container = new constructor(this, config.container, widget);

		}

		this._postInit();

		if ('roles' in  config) Lava.view_manager.dispatchRoles(this, config.roles);

	}
709357
function( config ) {
		
		for( var key in lm.config.itemDefaultConfig ) {
			if( config[ key ] === undefined ) {
				config[ key ] = lm.config.itemDefaultConfig[ key ];
			}
		}
		
		return config;
	}
1082526
function() {
            var self = this;

            this.template = this.options.template;
            this.args = this.options.args || {};

            // Related view
            this.view = this.options.view || null;

            // Init template context
            _.extend(this.args, {
                "_": _,
                "hr": {
                    "configs": configs,
                    "urls": Urls,
                    "i18n": I18n,
                    "offline": Offline
                },
                "view": {
                    "component": function(cid, args, name, subid) {
                        name = name || cid;

                        if (!self.view) {
                            throw new Error("Error in template " + self.template + " : try to import component in a non view-related template ");
                        }

                        if (Template.components[cid] == null) {
                            throw new Error("Error in template " + self.template + " : try to import component "+cid);
                        }

                        var view = new Template.components[cid].Class(args || {}, self.view);
                        
                        self.view.addComponent(name, view);

                        var component = $("<component/>", {
                            "data-component": view.cid
                        });

                        return component[0].outerHTML;
                    }
                },
                "template": {
                    "args": this.args,
                    "name": this.template,
                    "import": function(name, args, cname) {
                        cname = cname || name;
                        return this.args.view.component("template", {template: name, args: args}, cname);
                    },
                    "htmlid": function(h) {
                        return _.escape(h);
                    }
                }
            }, Template.options);

            return this;
        }
235031
function (out) {
            var typeUtil = ariaUtilsType, placeholderManager = ariaEmbedPlaceholderManager;
            var placeholderPath = this._placeholderPath;
            var contents = placeholderManager.getContent(placeholderPath);
            for (var i = 0, ii = contents.length; i < ii; i++) {
                var content = contents[i];
                if (typeUtil.isString(content)) {
                    out.write(content);
                } else {
                    // Assume json here (aria.html.beans.TemplateCfg)
                    var template = new ariaHtmlTemplate(content, this._context, this._lineNumber);
                    template.subTplCtxt.placeholderPath = placeholderPath;
                    out.registerBehavior(template);
                    template.writeMarkup(out);
                }
            }
        }