Rewrite the output of a view field
Last updated on
1 December 2016
You can configure a field in a view to display information that is different from the actual data in the field. By using tokens, you can enhance the field with dynamic content from the database.
- Navigate to the edit screen for a view (for example, admin/structure/views/view/MYVIEWNAME/edit).
- In the Fields section, click a field. The Configure Field dialog box displays.
- Click Rewrite Results.
- Enable any of the following options:
- Rewrite the output of this field You can replace the field with custom text which may include a subset of HTML. When this option is enabled, a list of tokens is displayed which you can use to dynamically add data to the custom text.
- Output this field as a link You must enter the link path. You can also configure various options for how the link will be displayed.
- Trim this field to a maximum length Enter the maximum number of characters that will be displayed.
- Strip HTML tags When this option is enabled, all HTML tags will be stripped. You can also specify certain tags to keep.
- Remove whitespace If this option is enabled, all whitespace at the beginning and the end of the output will be removed.
- Convert newlines to HTML <br> tags If this option is enabled, all newline characters (e.g. \n) are converted into break tags.
- Click Apply.