Warning: This page has not been updated in over over a year and may be outdated or deprecated.
development:architecture:record_data_formatter
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionNext revisionBoth sides next revision | ||
development:architecture:record_data_formatter [2016/12/01 15:32] – created demiankatz | development:architecture:record_data_formatter [2018/05/09 13:33] – [Specification Array] demiankatz | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== RecordDataFormatter view helper ====== | ====== RecordDataFormatter view helper ====== | ||
+ | |||
+ | :!: // This page describes functionality that was added in VuFind 4.0. // | ||
VuFind includes a RecordDataFormatter view helper designed to make it easier to customize the contents of tabular displays of data generated from [[development: | VuFind includes a RecordDataFormatter view helper designed to make it easier to customize the contents of tabular displays of data generated from [[development: | ||
Line 10: | Line 12: | ||
* A [[development: | * A [[development: | ||
- | As output, getData() returns an associative array of field name < | + | As output, getData() returns |
+ | |||
+ | Field names are raw and should be translated/ | ||
+ | |||
+ | Additionally, | ||
+ | |||
+ | ===== Specification Array ===== | ||
+ | |||
+ | The specification array uses as keys the labels to be displayed in the resulting table of data. Each key is associated with a value which is itself an associative array with one or more of the following keys: | ||
+ | |||
+ | ^Key^Optional/ | ||
+ | | allowZero | optional (default = true) | If the raw data evaluates to 0 or ' | ||
+ | | context | optional | An array of contextual values that may be used to help with template rendering; these are always passed through as the ' | ||
+ | | dataMethod | :!: required :!: | The record driver method to use for extracting raw field data used for generating output. May be set to boolean true to always generate output without variable input; may be set to boolean false to suppress the entire field. | | ||
+ | | helperMethod | optional | The Record view helper method to use for output rendering, when renderType = RecordHelper. | | ||
+ | | pos | optional | An integer used for sorting the fields to determine the final display order. | | ||
+ | | renderType | optional (default = Simple) | The method used to render output from the input provided by dataMethod. Legal values: **Multi** (sort data using a callback function specified by the ' | ||
+ | | labelFunction | optional | May be set to a callback function which will receive the raw field data as input and produce a custom output label (overriding the key of the spec array) as output. Starting with VuFind 5.0, the callback function also receives the record driver object as a second parameter. | | ||
+ | | prefix | optional | HTML to prepend to the output generated by the view helper. Applies only when RenderType = Simple. | | ||
+ | | recordLink | optional | The type of link (from the Record view helper' | ||
+ | | separator | optional (default = < | ||
+ | | suffix | optional | HTML to append to the output generated by the view helper. Applies only when RenderType = Simple. | | ||
+ | | template | optional | The name of the template to render, when renderType = RecordDriverTemplate | | ||
+ | | translate | optional (default = false) | Should we run raw field data through the translator? Applies only when RenderType = Simple. | | ||
+ | | translationTextDomain | optional (default = '' | ||
+ | | useCache | optional (default = false) | Should we cache the raw field data in the view helper to avoid duplicate calls? | | ||
+ | |||
+ | ===== The Specification Builder ===== | ||
+ | |||
+ | A [[https:// | ||
- | Additionally, | + | Useful public |
+ | * setLine($key, | ||
+ | * setTemplateLine($key, | ||
+ | * reorderKeys($orderedKeys, | ||
===== Customizing Specifications ===== | ===== Customizing Specifications ===== | ||
Line 20: | Line 54: | ||
==== Option 1: Override the Factory ==== | ==== Option 1: Override the Factory ==== | ||
- | If you want to make global changes to a specification, | + | If you want to make global changes to a specification, |
==== Option 2: Override the Template ==== | ==== Option 2: Override the Template ==== |
development/architecture/record_data_formatter.txt · Last modified: 2023/12/11 16:11 by dltj