Element views allow to group (elements of) resource types for editing them in the page editor. If more than one (non-empty) element view is available, the user can choose the view and dependent on that view, he can add, edit and move elements of different resource types a page.
Element views are in particular useful to
Element views are resources of type elementview
. Typically element views are defined in modules that expose the resources types that should be shown in an element view. By convention, element views are stored in a subfolder elementviews/
of the module folder. When an element view content is defined, it automatically makes up an element view, selectable in all resource type configurations and (if non-empty and accessible to the current user) selectable in the page editor.
To create a new element view:
elementviews/
of this module..xml
) and edit the metadata.The element view content stores mainly the name of the view used when the view is displayed in the page editor's context menu. Moreover you can alter the display order.
The title is mapped to the Title property and used as name of the view in the page editor, if no title key is given.
A key from a workplace message bundle to show a localized name of the element view in the page editor. Provide only the rare key, e.g., myelementview.title
.
Non-negative integer value to specify the display order relative to other element views. Element views with smaller numbers are displayed earlier.
By setting permissions on the element view content, you can determine who is allowed to see the view. Only users with permissions on the elementview content get the view displayed for selection in the page editor.
Element views can be added by modules. Thus, many different element views may exist, but you may not want to show all of them to all users.
Thus, element views can only be selected via the page editor if:
Element views are identified via the structure id of the element view content. Thus, element views with equal names imported via different modules will not conflict. The default view plays a special role. It has no content and is identified via the null id.
Element views are sorted by their display order. From the views that can be chosen, i.e., the non-empty views where the user has sufficient permissions to access them, a view with the smallest display order is chosen as default. Typically, if not empty, the default view is chosen by default.
If a user once selected a view, this view is kept - at least as long as it can be chosen.
The current view is stored in the session cache, i.e., in CmsADESessionCache. The class provides the according getter and setter.