lib/packages/core-classes.js
function(schema, raw_tag, parent_title) {

		var widget_config = Lava.parsers.Common.createDefaultWidgetConfig(),
			tags,
			name,
			x = raw_tag.x;

		widget_config['extends'] = parent_title;

		if (raw_tag.content) {

			// Lava.isVoidTag is a workaround for <x:attach_directives>
			// It's highly discouraged to make sugar from void tags
			if (Lava.isVoidTag(raw_tag.name) || !schema.content_schema) {

				tags = Lava.parsers.Common.asBlocks(raw_tag.content);
				tags = this._applyTopDirectives(tags, widget_config);
				if (Lava.schema.DEBUG && tags.length) Lava.t("Widget is not allowed to have any content: " + raw_tag.name);

			} else {

				if (Lava.schema.DEBUG && !(schema.content_schema.type in this._root_map)) Lava.t("Unknown type of content in sugar: " + schema.content_schema.type);
				this[this._root_map[schema.content_schema.type]](schema.content_schema, raw_tag, widget_config, schema.content_schema.name);

			}

		}

		if (raw_tag.attributes) {

			this._parseRootAttributes(schema, raw_tag, widget_config);

		}

		if (x) {

			if (Lava.schema.DEBUG && x) {
				for (name in x) {
					if (['label', 'roles', 'resource_id', 'controller'].indexOf(name) == -1) Lava.t("Control attribute is not allowed on sugar: " + name);
				}
			}

			if ('label' in x) this.setViewConfigLabel(widget_config, x.label);
			if ('roles' in x) widget_config.roles = Lava.parsers.Common.parseTargets(x.roles);
			if ('resource_id' in x) widget_config.resource_id = Lava.parsers.Common.parseResourceId(x.resource_id);
			if ('controller' in x) widget_config.real_class = x.controller;

		}

		return widget_config;

	}
function(schema, raw_tag, parent_title) {

		var widget_config = Lava.parsers.Common.createDefaultWidgetConfig(),
			tags,
			name,
			x = raw_tag.x;

		widget_config['extends'] = parent_title;

		if (raw_tag.content) {

			// Lava.isVoidTag is a workaround for <x:attach_directives>
			// It's highly discouraged to make sugar from void tags
			if (Lava.isVoidTag(raw_tag.name) || !schema.content_schema) {

				tags = Lava.parsers.Common.asBlocks(raw_tag.content);
				tags = this._applyTopDirectives(tags, widget_config);
				if (Lava.schema.DEBUG && tags.length) Lava.t("Widget is not allowed to have any content: " + raw_tag.name);

			} else {

				if (Lava.schema.DEBUG && !(schema.content_schema.type in this._root_map)) Lava.t("Unknown type of content in sugar: " + schema.content_schema.type);
				this[this._root_map[schema.content_schema.type]](schema.content_schema, raw_tag, widget_config, schema.content_schema.name);

			}

		}

		if (raw_tag.attributes) {

			this._parseRootAttributes(schema, raw_tag, widget_config);

		}

		if (x) {

			if (Lava.schema.DEBUG && x) {
				for (name in x) {
					if (['label', 'roles', 'resource_id', 'controller'].indexOf(name) == -1) Lava.t("Control attribute is not allowed on sugar: " + name);
				}
			}

			if ('label' in x) this.setViewConfigLabel(widget_config, x.label);
			if ('roles' in x) widget_config.roles = Lava.parsers.Common.parseTargets(x.roles);
			if ('resource_id' in x) widget_config.resource_id = Lava.parsers.Common.parseResourceId(x.resource_id);
			if ('controller' in x) widget_config.real_class = x.controller;

		}

		return widget_config;

	}
function ( schema , raw_tag , parent_title ) { var widget_config = Lava . parsers . Common . createDefaultWidgetConfig ( ) , tags , name , x = raw_tag . x ; widget_config [ 'extends' ] = parent_title ; if ( raw_tag . content ) { // Lava.isVoidTag is a workaround for <x:attach_directives> // It's highly discouraged to make sugar from void tags if ( Lava . isVoidTag ( raw_tag . name ) || ! schema . content_schema ) { tags = Lava . parsers . Common . asBlocks ( raw_tag . content ) ; tags = this . _applyTopDirectives ( tags , widget_config ) ; if ( Lava . schema . DEBUG && tags . length ) Lava . t ( "Widget is not allowed to have any content: " + raw_tag . name ) ; } else { if ( Lava . schema . DEBUG && ! ( schema . content_schema . type in this . _root_map ) ) Lava . t ( "Unknown type of content in sugar: " + schema . content_schema . type ) ; this [ this . _root_map [ schema . content_schema . type ] ] ( schema . content_schema , raw_tag , widget_config , schema . content_schema . name ) ; } } if ( raw_tag . attributes ) { this . _parseRootAttributes ( schema , raw_tag , widget_config ) ; } if ( x ) { if ( Lava . schema . DEBUG && x ) { for ( name in x ) { if ( [ 'label' , 'roles' , 'resource_id' , 'controller' ] . indexOf ( name ) == - 1 ) Lava . t ( "Control attribute is not allowed on sugar: " + name ) ; } } if ( 'label' in x ) this . setViewConfigLabel ( widget_config , x . label ) ; if ( 'roles' in x ) widget_config . roles = Lava . parsers . Common . parseTargets ( x . roles ) ; if ( 'resource_id' in x ) widget_config . resource_id = Lava . parsers . Common . parseResourceId ( x . resource_id ) ; if ( 'controller' in x ) widget_config . real_class = x . controller ; } return widget_config ; }
Parse raw tag as a widget
@param {_cSugar} schema
@param {_cRawTag} raw_tag
@param {string} parent_title
Parse raw tag as a widget