Use content field as data attribute in Views html I have a piece of content with an 'Asset Type' field value of Vidyard.  I am using the Views module to render this content on another page.  I have added those fields to the View, but is it possible to add them as a data-attribute to the HTML.  For example, the Views module outputs:

&lt;li class="views-row views-row-2 views-row-even views-row-last"&gt;
    etc.
&lt;/li&gt;


How can I add my "Asset Type" field as a data-attribute to the list item.  Making my output:

&lt;li class="views-row views-row-2 views-row-even views-row-last" data-asset="vidyard"&gt;


Is there a way to do this without altering the template?
There are some limitations if you can't change the output templates for the view (and I'd assume if that's the case a views pre render is also out of scope). If you can accept them within the &lt;li&gt; (instead of on the &lt;li&gt;) you can rewrite the field to use a token. Make sure the field that is just data is listed before the field it will be attached to, enabled rewriting on the field, and use the field tokens to attach the value as an attribute. You'll most likely want to suppress the field from output and do some data cleaning to make sure invalid characters don't end up in the token (like ").



You can attach classes based on the row value to the li by using the same token you would use on the rewrite. Drupal will ensure it's safe for output, but then your data is a class and not the attribute you are seeking.

You'll have more control over the output, and you'll be able to build more elegant solutions if you use hook_views_pre_render() to modify the output more directly.