Feature: The list elements render their view modes
Description
The list, list-and-detail, selected profiles and selected contracts elements offered a View Mode Default and a View Mode Toggle that no template read. Both take effect now:
- View Mode Default renders the tile grid - the item keeps its
stored value
listand is labelled Tiles - or a table. The table has one row per profile, one per contract in the selected contracts element, and the columns name, position, e-mail, phone and room. - View Mode Toggle offers the visitor a switch between the allowed modes. The active mode is marked as current, and the pagination and the letter navigation keep the chosen mode.
- Two site settings,
plugin.(defaulttx_ academicpersons. view Mode. allowed list,table) andplugin.(defaulttx_ academicpersons. table. columns name,position,email), decide which modes exist and what the table shows. A requested mode outside the allowed ones, or requested while the switch is off, renders the default mode.Addresses,phone Numbers,room - The route enhancers
List.andyaml Listgive a mode other than the default a speaking URL,And Detail. yaml /view-, also with a page or a letter behind it.mode/ table
A project adds a mode without a template override: a partial
Profile/, the mode in the allowed modes, and an item
of View Mode Default in page TSconfig. Its links carry it as a query
argument until the site adds it to the map of the route enhancer.
See View modes, View modes, Adding a view mode and A view mode of your own in the URL.
Impact
A content element saved with the default Tiles, or before the field existed, renders as before. One that an editor set to Table renders a table from now on, and one with the toggle switched on shows the switch.
Partials/ and the selected profiles and
contracts templates render the items through Profile/
instead of Profile/, and the list template renders the
switch. A project copy of Item or of a selected template keeps
rendering the grid whatever the mode; a copy of the list template shows the
mode Item renders, without a switch. Adopt the shipped files to
use the view modes. A project's own table or listener for these fields can be
removed.
The table honours the fields of the content element: a contract field left out of Show only selected Fields is left out of the table as well.
A site that imports the route enhancers gets the three new routes of each enhancer. The existing URLs do not change.