Warning: This page has not been updated in over over a year and may be outdated or deprecated.
development:howtos:displaying_a_custom_field:vufind6_example
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
development:howtos:displaying_a_custom_field:vufind6_example [2020/04/14 12:39] – created demiankatz | development:howtos:displaying_a_custom_field:vufind6_example [2023/11/09 21:32] (current) – demiankatz | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Displaying a Custom | + | ====== Displaying a Custom |
// This example shows you how to set up a custom module, custom theme and custom record driver. It assumes that you have already added a custom field to your Solr index named RecID -- you can see more concrete examples of adding fields on the [[indexing: | // This example shows you how to set up a custom module, custom theme and custom record driver. It assumes that you have already added a custom field to your Solr index named RecID -- you can see more concrete examples of adding fields on the [[indexing: | ||
Line 51: | Line 51: | ||
cd $VUFIND_HOME/ | cd $VUFIND_HOME/ | ||
mkdir -p ThemeName/ | mkdir -p ThemeName/ | ||
+ | |||
* Put the following content in $VUFIND_HOME/ | * Put the following content in $VUFIND_HOME/ | ||
Line 63: | Line 64: | ||
* Edit $VUFIND_HOME/ | * Edit $VUFIND_HOME/ | ||
- | | + | For example, you could add this immediately preceding the div with a class of " |
- | <? $recordID = $this-> | + | |
- | < | + | <? $recordID = $this-> |
- | < | + | |
- | <? | + | |
- | | + | |
- | <? endif; ?> | + | |
+ | | ||
* Edit $VUFIND_LOCAL_DIR/ | * Edit $VUFIND_LOCAL_DIR/ | ||
+ | 6. To add a new field to the core record view, you will need to add some custom configuration to the [[development: | ||
+ | |||
+ | * First, create this directory: | ||
+ | |||
+ | mkdir -p $VUFIND_HOME/ | ||
+ | |||
+ | * Now, create a custom RecordDataFormatterFactory in your local code module; this is where configurations are set up. For example, you could edit $VUFIND_HOME/ | ||
+ | |||
+ | <? | ||
+ | |||
+ | | ||
+ | |||
+ | use VuFind\View\Helper\Root\RecordDataFormatter\SpecBuilder; | ||
+ | |||
+ | class RecordDataFormatterFactory extends \VuFind\View\Helper\Root\RecordDataFormatterFactory | ||
+ | { | ||
+ | | ||
+ | { | ||
+ | $spec = new SpecBuilder(parent:: | ||
+ | | ||
+ | | ||
+ | } | ||
+ | } | ||
+ | |||
+ | * Finally, edit $VUFIND_HOME/ | ||
+ | |||
+ | <? | ||
+ | | ||
+ | ' | ||
+ | ' | ||
+ | ]; | ||
+ | |||
+ | |||
+ | :!: In this example, the key line is $spec-> | ||
---- struct data ---- | ---- struct data ---- | ||
+ | properties.Page Owner : | ||
---- | ---- | ||
development/howtos/displaying_a_custom_field/vufind6_example.1586867991.txt.gz · Last modified: 2020/04/14 12:39 by demiankatz