Horde_View_Sidebar
extends Horde_View
in package
This is a view of the application-specific sidebar.
Useful properties:
- newLink: (string, optional) Link of the "New" button
- newText: (string) Text of the "New" button
- newExtra: (string, optional) HTML content of the extra link
- containers: (array, optional) HTML content of any sidebar sections. A list of hashes with the following properties: - id: (string, optional) The container's DOM ID. - header: (array, optional) Container header, also used to toggle the section: - id: (string) The header's DOM ID. - label: (string) Header label. - collapsed: (boolean, optional) Start section collapsed? Overriden by cookies. - add: (string|array, optional) Link to add something: - url: (string) Link URL. - label: (string) Link text. - content: (string, optional) The container's HTML content. - rows: (array, optional) A list of row hashes, if 'content' is not specified. @see addRow(). - resources: (boolean, optional) Does the container contain switchable resource lists? Automatically set through addRow(). - type: (string, optional) @see addRow().
- content: (string, optional) HTML content of the sidebar, if 'containers' is not specified.
Copyright 2012-2017 Horde LLC (http://www.horde.org/)
See the enclosed file LICENSE for license information (LGPL-2). If you did not receive this file, see http://www.horde.org/licenses/lgpl.
Tags
Table of Contents
- __construct() : mixed
- Constructor.
- __toString() : string
- Handler for string casting.
- addNewButton() : mixed
- Adds a "New ..." button to the sidebar.
- addRow() : mixed
- Adds a row to the sidebar.
- render() : string
- Returns the HTML code for the sidebar.
Methods
__construct()
Constructor.
public
__construct([array<string|int, mixed> $config = array() ]) : mixed
Parameters
- $config : array<string|int, mixed> = array()
-
Configuration key-value pairs.
Return values
mixed —__toString()
Handler for string casting.
public
__toString() : string
Return values
string —The sidebar's HTML code.
addNewButton()
Adds a "New ..." button to the sidebar.
public
addNewButton(string $label, string $url[, array<string|int, mixed> $extra = array() ]) : mixed
Parameters
- $label : string
-
The button text, including access key.
- $url : string
-
The button URL.
- $extra : array<string|int, mixed> = array()
-
Extra attributes for the link tag.
Return values
mixed —addRow()
Adds a row to the sidebar.
public
addRow(array<string|int, mixed> $row[, string $container = '' ]) : mixed
If containers/sections are not added explicitly to the view through the "containers" property, these rows will be used instead.
Parameters
- $row : array<string|int, mixed>
-
A hash with the row information. Possible values:
- label: (string) The row text.
- selected: (boolean) Whether to mark the row as active.
- style: (string) Additional CSS styles to apply to the row.
- url (string) URL to link the row to.
- type (string, optional) The row type, defaults to "tree". Further
$row properties depending on the type:
- tree:
- cssClass: (string) CSS class for the icon.
- id: (string) DOM ID for the row link.
- checkbox:
- radiobox:
- color: (string, optional) Background color.
- edit: (string, optional) URL for extra edit icon.
- tree:
- $container : string = ''
-
If using multiple sidebar sections, the ID of the section to add the row to. Sections will be rendered in the order of their first usage.
Return values
mixed —render()
Returns the HTML code for the sidebar.
public
render([string $name = 'sidebar' ][, mixed $locals = array() ]) : string
Parameters
- $name : string = 'sidebar'
-
The template to process.
- $locals : mixed = array()
Return values
string —The sidebar's HTML code.