Difference between revisions of "ARK2/View"

From ARK
Jump to: navigation, search
(Tables)
(Tables)
Line 56: Line 56:
 
| name
 
| name
 
| name()
 
| name()
|
+
| string
 
|
 
|
 
|-
 
|-

Revision as of 16:59, 19 March 2018

View

ARK2 provides a table driven configuration of Views on Data Schemas and Items, such as Pages, Forms and Tables. View Elements can be nested to build up complex layouts.

View Elements

View elements are either Basic Elements, or Compound Elements made up of other Basic and/or Compound Elements.

Basic Elements

  • Widget - An object embedded in a page, e.g. a form element, text element, button, etc
  • Field - A widget that is linked to a specific Attribute in a Schema and inherits its behaviour from that Attribute, e.g. an Actor's name is a text form field with defined size constraints
  • Nav - A widget that is used for site navigation, e.g. a clickable link with or without an icon

Compound Elements

  • Page - A layout of other elements in a page, with standard elements such as header, sidebar, footer, and content
  • Grid - A layout of other elements in rows and columns, both basic and compound
  • Form - An HTML5 Form
  • Table - An HTML5 Table
  • Tree - Currently not implemented, a layout of other elements in a hierarchical tree, e.g. a navigation menu

View Tables / Classes

ark_view_cell - ARK\View\Cell
ark_view_element - ARK\View\Element
ark_view_field - ARK\View\Field
ark_view_form - ARK\View\Form
ark_view_group - ARK\View\Grid
ark_view_nav - ARK\View\Nav
ark_view_page - ARK\View\Page
ark_view_table - ARK\View\Table
ark_view_tree - ARK\View\Tree
ark_view_type - ARK\View\Type
ark_view_widget - ARK\View\Widget

Tables

Tables are a Compound Element defined by the ARK\View\Table class, and can only embed ARK\View\Field or ARK\View\Widget Basic Elements. They cannot embed other Compound Elements. When a Table embeds Field Elements, then all Fields must belong to a single Schema, i.e. a Table embeds a Schema, with each row embedding an Item that is an instance of that Schema.

The Table Element is defined in the ark_view_table table, which is mapped by Doctrine to the ARK\View\Table class. The definition seeks to abstract the HTML5 Table definition and the currently chosen JavaScript Table widget in a generic way to avoid implementation specifics. The Twig or JavaScript frontends are expected to translate this generic definition into the specific implementation being used.

Table Definition
Database Field Class Method Datatype Description
element id() string The ID of the Table element
name name() string
type() ARK\View\Type
mode mode() boolean
caption showCaption() boolean
header showHeader() boolean
footer showFooter() boolean
sortable isSortable() boolean
searchable isSearchable() boolean
list enableListView() boolean
detail enableDetailView() boolean
expand enableExpandListView() boolean only if list and detail
card enableCardView() boolean
thumb enableThumbnailView() boolean
view defaultView() string defaults to list, [list, card, thumb]
image image() string
export canExportData() boolean
columns canChooseColumns() boolean
pagination pagination(), pageSize() boolean, integer defaults to 10
selection selection() string
keyword keyword() string, ARK\Translation\Keyword
classes classes() string
template template() string
url dataUrl() string