Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision |
development:architecture:record_data_formatter [2020/02/27 14:09] – [Specification Array] demiankatz | development:architecture:record_data_formatter [2020/09/22 14:19] – demiankatz |
---|
===== The Specification Builder ===== | ===== The Specification Builder ===== |
| |
A [[https://github.com/vufind-org/vufind/blob/master/module/VuFind/src/VuFind/View/Helper/Root/RecordDataFormatter/SpecBuilder.php|SpecBuilder]] convenience class has been provided to help generate specification arrays. This handles such functionality as auto-generating useful 'pos' values, reordering/overriding fields, etc. | A [[https://github.com/vufind-org/vufind/blob/dev/module/VuFind/src/VuFind/View/Helper/Root/RecordDataFormatter/SpecBuilder.php|SpecBuilder]] convenience class has been provided to help generate specification arrays. This handles such functionality as auto-generating useful 'pos' values, reordering/overriding fields, etc. |
| |
Useful public methods: | Useful public methods: |
==== Option 1: Override the Factory ==== | ==== Option 1: Override the Factory ==== |
| |
If you want to make global changes to a specification, the easiest solution is to extend [[https://github.com/vufind-org/vufind/blob/master/module/VuFind/src/VuFind/View/Helper/Root/RecordDataFormatterFactory.php|\VuFind\View\Helper\Root\RecordDataFormatterFactory]] in your own [[development:architecture:customizing_vufind#modules|custom module]] and override getDefaultCoreSpecs() and/or getDefaultDescriptionSpecs() as needed. You can either completely rewrite the spec generation logic, or you can call the parent version of the function and then manipulate the array slightly to add, remove or reorder fields. | If you want to make global changes to a specification, the easiest solution is to extend [[https://github.com/vufind-org/vufind/blob/dev/module/VuFind/src/VuFind/View/Helper/Root/RecordDataFormatterFactory.php|\VuFind\View\Helper\Root\RecordDataFormatterFactory]] in your own [[development:architecture:customizing_vufind#modules|custom module]] and override getDefaultCoreSpecs() and/or getDefaultDescriptionSpecs() as needed. You can either completely rewrite the spec generation logic, or you can call the parent version of the function and then manipulate the array slightly to add, remove or reorder fields. |
| |
==== Option 2: Override the Template ==== | ==== Option 2: Override the Template ==== |