public static Map<String, WComponent> mapTaggedComponents(final Map<String, Object> context, final Map<String, WComponent> taggedComponents) {

		Map<String, WComponent> componentsByKey = new HashMap<>();

		// Replace each component tag with the key so it can be used in the replace writer
		for (Map.Entry<String, WComponent> tagged : taggedComponents.entrySet()) {
			String tag = tagged.getKey();
			WComponent comp = tagged.getValue();

			// The key needs to be something which would never be output by a Template.
			String key = "[WC-TemplateLayout-" + tag + "]";
			componentsByKey.put(key, comp);

			// Map the tag to the key in the context
			context.put(tag, key);
		}

		return componentsByKey;
	}
public static Map < String , WComponent > mapTaggedComponents ( final Map < String , Object > context , final Map < String , WComponent > taggedComponents ) { Map < String , WComponent > componentsByKey = new HashMap < > ( ) ; for ( Map . Entry < String , WComponent > tagged : taggedComponents . entrySet ( ) ) { String tag = tagged . getKey ( ) ; WComponent comp = tagged . getValue ( ) ; String key = "[WC-TemplateLayout-" + tag + "]" ; componentsByKey . put ( key , comp ) ; context . put ( tag , key ) ; } return componentsByKey ; }
Replace each component tag with the key so it can be used in the replace writer.

@param context the context to modify.
@param taggedComponents the tagged components

@return the keyed components