Disclaimer: This page is a work in progress. Information may be missing but will be added at a later point.
Nomenclature for fields
When setting up the content type for a view it is always a good idea to use a consistent nomenclature for all the fields. Doing so will allow for easy searching for the field later while adding it to views, and will also provide a unique identifier for styling
EX: field_[view_name]_[name-of-field]
View name = People
field_people_title
field_people_location
field_people_number
Change the administrative title of a field as needed
When working with views it is common to either have multiple fields of the same type (date, title, image, etc.) or a field name which was poorly named. Because of this it is advised to change the administrative title of a field to something more reasonable should the view ever need to be returned to at a later date.
Ex:View name = Events
Content: date --revised name--> Month content: date --revised name--> Day
Setting No result Behavior
No result behavior as implied is the display behavior for a field when information is not present. Setting this to either Hide if empty or Count the number 0 as empty is important, because otherwise the field will still exist but not display information ruining the formatting of the view.
- Click on the field to be modified
- Click no result behavior
- Select hide if empty or count the number 0 as empty depending on the necessity of the view
- Apply the changes and save
Usable Body fields
Body is a common field which will be used within a view. However, some formats have some caveats to there use within a view.
- Default: Using this format is ill-advised as often times images, internal styling, and positional information can bleed into the view otherwise ruining the desired format or in worst case scenarios breaking other elements of a site
- Plain text: The default format while working with body. Plain text strips all the aforementioned problems but is limited in it can only display text. If providing the body field is important do not use this format
- Trimmed: Trimmed is no different from default and shares many of it's problems. However, it possess it's own problem as images are counted towards characters. If working with a view that has a lot of images but the content is important do not use this format.
- Summary or Trimmed An uncommon format but quite useful for articles, news or events. If a Summary is provided the view will use this instead of trimming from the default body field. This allows for a greater control of the outputed message
Trimming the body field
If ever there is a need to trim the body field for a specific reason. It is advised to use a rewrite rule rather than the trimmed format(see Usable fields for more information)
- Click on the field desired to be trimmed
- Under Rewrite Results click Trim this field to a maximum length
- Set the maximum length
- Apply the changes and save
If a body field is ever used within a view it is important to set the format to plain text. Doing this will remove any internal styling, images, or formatting which would ruin the format of the view
Styling views
Styling views while straight-forward can cause many complications if done correctly. When styling a view a few things are important to remember:
- Be as specific as possible when styling fields
- Ex: wrong: .title{font-weight:700;} vs #display-block-1 .views-field-field-title{font-weight: 700;}. This will reduce the bleed of styling as view fields remain the same but can be used on multiple formats (page, bloc, attachment, etc.)
- Do not use inline styling
- Note: inline styling may be used for testing purposes but should be removed from the view to not cause any conflicts and reduce junk code