webCOMAND

cpath_view Class

  • Namespace: \com_webcomand\components
  • Extends: base_component
  • Implements: content_view_container

A class that implements component to display object(s) at a given cPath in a panel.  The panel can be customized, but it will include the following components by default.

  • Form ViewTitle Bar - Displays just a Title or a back button followed by a Path and options menu.
  • Toolbar - If a single object is referenced, the Object Toolbar is display.  Otherwise the Collection Toolbar is display.
  • View - The specified or automatically selected (by the system or user preference) view to use to display the object or collection.

Example

// Display a collection of users in whatever view the system determines
// is best.
$this->add_component('\com_webcomand\components\cpath_view', [
    'Container' => 'LeftViewContainer',
    'Identifier' => 'list',
    cpath_view::CPATH => '[:User]'
]);

// Display a list of users in Simple List view.
$this->add_component('\com_webcomand\components\cpath_view', [
    'Container' => 'LeftViewContainer',
    'Identifier' => 'list',
    cpath_view::CPATH => '[:User]',
    cpath_view::VIEW => 'com.webcomand.simplelist'
]);

Component Options

The cPath view component has many options:

cPaths

  • cpath_view::CPATH - A cPath object or string that references the object or collection to display.  Default is NULL, which means that no cPath will display.
  • cpath_view::CPATH_SELECTED - A cPath object or string that references the object or collection to be initially selected.  Default is '', which means nothing is selected.

Toolbar Options

  • cpath_view::TOOL_BAR - Control the toolbar with either coarse or per-feature control.
    • The following coarse toolbar option value can be set to simply enable, show, hide or disable the entire toolbar:
      • cpath_view::OPTION_AUTO - Initially show or hide the toolbar based on the user preference or view default.
      • cpath_view::OPTION_SHOW - Initially show the toolbar, even if the user preference or view default is to hide.
      • cpath_view::OPTION_HIDE - Initially hide the toolbar, even if the user preference or view default is to show.
      • cpath_view::OPTION_DISABLED - Always hide the toolbar and do not provide an option to show it.
    • For per-feature control, the toolbar option value must be an associative array with one or more of the following keys:
      • cpath_view::DISPLAY - One of the coarse values defined above.
      • cpath_view::SELECT_RESTORE - Determine how to display the Restore option in the selection mode drop-down.
        • cpath_view::OPTION_SHOW - Show.
        • cpath_view::OPTION_HIDE - Do not show.
        • cpath_view::OPTION_DISABLE - Show as disabled, so it can no be selected.
      • cpath_view::ITEMS - Array of items (buttons and features) to include in the toolbar.
        • Object Toolbar
          • 'Submit' - Approve/Publish button.
          • 'Save' - Save/Preview button.
          • 'Cancel' - Cancel button.
        • Collection Toolbar
          • 'Select' - Selection mode toggle button (checkbox icon).  Only applies if cpath_view::SELECTION_MODE is set.
          • 'New' - New button/menu.
          • 'Edit' - Edit option (pencil icon), which only works for views that support edit mode, such as Map View.
          • 'View' - ?
          • 'Cut' - Show cut button when in selection mode.
          • 'Copy' - Show cut button when in selection mode.
          • 'Paste' - Show paste button when a compatible object is in the clipboard
          • 'Link' - Show link button when a compatible object is in the clipboard
          • 'Unlink' - Show unlink button when in selection mode.
          • 'Delete' - Show delete button when in selection mode.
          • 'Import' - Show import button.
          • 'Export' - Show export button.
          • 'Share' - Display the share button.
          • 'More' - Display the hamburger menu with the other options in it.
          • 'Filter' - Display the search/filter input.
          • 'Count' - Display the number of items in the collection, and the number of selected items in selection mode.
  • cpath_view::TOOL_BAR_ITEMS_PREPEND - Same as cpath_view::TOOL_BAR_ITEMS, except the specified items will be displayed before the default/automatic options.
  • cpath_view::TOOL_BAR_ITEMS_APPEND - Same as cpath_view::TOOL_BAR_ITEMS, except the specified items will be displayed after the default/automatic options.

Actions

  • cpath_view::ACTIONS - either disabled/enabled/auto, an array of action items, or an array of action style and items information.
  • cpath_view::ACTION_OVERRIDES - An associative array of actions to override with custom functionality.

 

Old Component Options

The cPath view component has many options:

cPath Options

  • cpath_view::CPATH - A cPath object or string that references the object or collection to display.  Default is NULL, which means that no cPath will display.
  • cpath_view::CPATH_SELECTED - A cPath object or string that references the object or collection to be initially selected.  Default is '', which means nothing is selected.
  • cpath_view::DOID - Optional DOID of dimension object to display, to force a specific dimension to display when the cPath resolves to a single object.  Default is 0, which means the default DOID will be used.

Data Source Options

  • cpath_view::SOURCE - \com_webcomand\components\cpath_source
  • cpath_view::SOURCE_OPTIONS = An array of view-specific source options.  See each view for details.
  • cpath_view::CPATH_PAGE_SIZE - Number of objects to include per page when AJAX paging is enabled.

Panel Options

  • cpath_view::PARENT_IDENTIFIER - Array of parent cpath_view component identifiers (strings).  Parent cpath_view components will open object(s) in this view, rather than updating their own view.
  • cpath_view::LAZY - If TRUE, the view will not be loaded until it is displayed (ie. it is a "slide out").  If FALSE (default), the view will be populated when the panel is loaded into the user interface, even if it is not yet visible.

View Options

  • cpath_view::VIEW => The view to initially display in the panel.
    • cpath_view::OPTION_VIEW_PREFERRED - Allow the preferred view to be automatically selected based on view weights and user preference.
  • cpath_view::VIEW_OPTIONS - Associative array with zero or more of the following key/value pairs.
    • content_view::OBJECT_ACTIONS - Enable or disable per-object actions on hover/swipe.  For example, the actions that display to the far right on mouse hover in simple list view.
      • content_view::OBJECT_ACTIONSOPTION_ENABLED - Show hover/swipe actions.
      • content_view::OPTION_DISABLED - Hide hover/swipe actions.
    • content_view::OBJECT_ACTION_ITEMS - Array of action identifiers:
      • Open
      • Cut
      • Copy
      • Delete
      • Unlink
  • cpath_view::VIEW_STYLE => static::OPTION_AUTO,
  • cpath_view::VIEW_EXCLUDE => array(),
  • cpath_view::VIEW_SAVE => FALSE,
  • cpath_view::VIEW_EMPTY_MESSAGE => 'No results found.',
  • cpath_view::VIEW_CHANGEABLE => TRUE,

Title Bar Options

  • cpath_view::TITLE_BAR -
    • static::OPTION_SHOW
  • cpath_view::TITLE_BAR_ICON - URL of icon to display to left of title.
  • cpath_view::TITLE_BAR_TITLE -
  • cpath_view::TITLE_BAR_STYLE - What to display in the title bar.
    • cpath_view::OPTION_TITLE_BAR_STYLE_PATH (default) - Show the last path breadcrumb, with option to expand.
    • cpath_view::OPTION_TITLE_BAR_STYLE_EXPANDED - Show the path breadcrumbs in expanded form, with option to contract.
    • cpath_view::OPTION_TITLE_BAR_STYLE_TITLE - Show the icon and title in the title bar.  Do not show the path or cPath edit option.
    • cpath_view::OPTION_TITLE_BAR_STYLE_SUMMARY - Show the icon and title in the title bar.  Do not show any options.
    • cpath_view::OPTION_TITLE_BAR_STYLE_DASHBOARD - Show only last path breadcrumb and option hamburger menu.  Show back button if appropriate and cpath_view::TITLE_BAR_BACK allows it.
    • cpath_view::OPTION_TITLE_BAR_STYLE_SLIDEOUT - Show icon and title only, with pushpin on right.
  • cpath_view::TITLE_BAR_BACK - Specifies whether or not to display the back button
    • cpath_view::OPTION_AUTO - Only display if appropriate (there is history, or a parent in the cPath).
    • cpath_view::OPTION_HIDE - Hide the back button.
  • cpath_view::TITLE_BAR_FORWARD => static::OPTION_DISABLED,
  • cpath_view::TITLE_BAR_MENU => static::OPTION_SHOW,
  • cpath_view::TITLE_BAR_MENU_EXPAND => static::OPTION_AUTO,
  • cpath_view::TITLE_BAR_MENU_ITEMS => static::OPTION_AUTO,

Toolbar Options

  • cpath_view::TOOL_BAR - Initially show or hide the object or collection toolbar, or disable completely.
    • cpath_view::OPTION_AUTO - Initially show or hide the toolbar based on the user preference or view default.
    • cpath_view::OPTION_SHOW - Initially show the toolbar, even if the user preference or view default is to hide.
    • cpath_view::OPTION_HIDE - Initially hide the toolbar, even if the user preference or view default is to show.
    • cpath_view::OPTION_DISABLED - Always hide the toolbar and do not provide an option to show it.
  • cpath_view::TOOL_BAR_ITEMS - Determines which options to include in the toolbar.
    • Object Toolbar
      • 'Submit' - Approve/Publish button.
      • 'Save' - Save/Preview button.
      • 'Cancel' - Cancel button.
    • Collection Toolbar
      • 'Select' - Selection mode toggle button (checkbox icon).  Only applies if cpath_view::SELECTION_MODE is set.
      • 'New' - New button/menu.
      • 'Edit' - Edit option (pencil icon), which only works for views that support edit mode, such as Map View.
      • 'View' - ?
      • 'Cut' - Show cut button when in selection mode.
      • 'Copy' - Show cut button when in selection mode.
      • 'Paste' - Show paste button when a compatible object is in the clipboard
      • 'Link' - Show link button when a compatible object is in the clipboard
      • 'Unlink' - Show unlink button when in selection mode.
      • 'Delete' - Show delete button when in selection mode.
      • 'Import' - Show import button.
      • 'Export' - Show export button.
      • 'Share' - Display the share button.
      • 'More' - Display the hamburger menu with the other options in it.
      • 'Filter' - Display the search/filter input.
      • 'Count' - Display the number of items in the collection, and the number of selected items in selection mode.
  • cpath_view::TOOL_BAR_ITEMS_PREPEND - Same as cpath_view::TOOL_BAR_ITEMS, except the specified items will be displayed before the default/automatic options.
  • cpath_view::TOOL_BAR_ITEMS_APPEND - Same as cpath_view::TOOL_BAR_ITEMS, except the specified items will be displayed after the default/automatic options.

View Bar Options

  • cpath_view::VIEW_BAR - Show, hide or disable the view bar, which is only available for views that implement.
    • cpath_view::OPTION_DISABLED - Hide the view bar and do not allow it to display.

Collection View Options

  • cpath_view::OPEN_WITH => FALSE,
  • cpath_view::OPEN_WITH_PRIMARY => FALSE,
  • cpath_view::OPEN_WITH_CPATH => FALSE,
  • cpath_view::SELECTABLE - Show, hide, require or disable selection mode.
    • cpath_view::OPTION_SHOW - Initially enable selection mode.
    • cpath_view::OPTION_HIDE - Initially hide selection mode.
    • cpath_view::OPTION_REQUIRED - Initially enable selection mode and do not allow it to be disabled.  In other words, if the 'Select' toolbar button is visible and clicked, show the drop-down, but do not exit selection mode.
    • cpath_view::OPTION_DISABLED - Do not allow selection mode.  In other words, do not display the 'Select' toolbar button even if it is specified or would appear automatically.
  • cpath_view::SELECTION_MODE - Display the list in one of the two selection modes.
    • cpath_view::OPTION_SELECTION_MODE_SINGLE - Display the list in single object selection mode.  When an object is clicked it will be selected.  Only one object can be selected.
    • cpath_view::OPTION_SELECTION_MODE_MULTIPLE - Display the list in multiple object selection mode (checkboxes).  When an object is clicked it will be selected.  Multiple objects can be selected.
  • cpath_view::ALLOW_SELECT_RESTORE -
  • cpath_view::CLEAR_SELECTION => TRUE,
  • cpath_view::ORDERABLE => static::OPTION_AUTO,
  • cpath_view::ORDERABLE_SAVE => static::OPTION_SAVE_EDITMODE,
  • cpath_view::ORDERABLE_FORCE => FALSE,
  • cpath_view::ONCLICK - What action to perform on click.  Options include:
    • cpath_view::OPTION_AUTO - Perform the default action for the view.
    • cpath_view::OPTION_ONCLICK_OPEN - Open the object in a new cPath view.
    • cpath_view::OPTION_ONCLICK_SELECT - Select the clicked item.
    • cpath_view::OPTION_ONCLICK_URL - Open a new window/tab with the given URL.
    • cpath_view::OPTION_ONCLICK_NOOP - Do nothing.
  • cpath_view::SORT => static::OPTION_AUTO,
  • cpath_view::FILTERABLE => static::OPTION_ENABLED,
  • cpath_view::FILTER => '',

Authorization Options

  • cpath_view::SUPER_AUTHORIZER => FALSE