Yes and no. An asset chooser can be used as a form field for a component, but assets cannot be inserted into the component source code.
Can I put a component or an asset inside a snippet?
Once a snippet is placed on a page, you can enter any kind of reusable content inside the snippet. However, depending on the snippet design, this may lead to unexpected results.
I placed my asset/component/snippet on a page, and now the page has a rendering error.
Any code inserted into a page, such as source code assets or the source code of a component or snippet, must either be XML-compliant or appropriately encoded, as it will be processed with the page XML before page publish.
Some common errors are:
- All tags need to be closed.
Unlike HTML, all tags in XML must close, either as self-closing tags or full tags.
- Boolean attributes must have a value.
HTML has some attributes which are considered boolean, meaning the attribute can be listed without a value. XML requires all attributes to have associated values, so add a value repeating the name of the attribute.
- Special characters must be encoded.
XML treats certain special characters in a unique manner. Any instances of those characters which appear in page content need to be encoded appropriately.