Difference between revisions of "Set field"
(Added ToC. Added API and Examples sections. Reorganised/completed other sections.) |
m (→Required Phrases) |
||
Line 35: | Line 35: | ||
== Required Phrases == | == Required Phrases == | ||
− | + | In addition to the [[Metadata#Required_Phrases|standard metadata field phrases]], if <code>input_style => 'short'</code> or <code>input_style => 'medium'</code> then the only extra phrases required are the name label for each of the options in the form: | |
datasetid + "_fieldopt_" + fieldname + "_" + optionname | datasetid + "_fieldopt_" + fieldname + "_" + optionname | ||
E.g. <tt>eprint_fieldopt_ispublished_unpub</tt> | E.g. <tt>eprint_fieldopt_ispublished_unpub</tt> |
Revision as of 22:57, 9 April 2023
EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects
Metadata Fields: Arclanguage - Base64 - Bigint - Boolean - Compound - Counter - Dataobjref - Date - Decimal - Email - Fields - Float - Id - Idci - Image - Int - Itemref - Keywords - Langid - Longtext - Longtext_counter - Multilang - Multipart - Name - Namedset - Pagerange - Recaptcha - Recaptcha3 - Relation - Search - Secret - Set - Storable - Subject - Subobject - Text - Time - Timestamp - Url - Uuid
Description
Allows a set of options to be specified using the options
attribute of the field's configuration. The set of options is then displayed in one of several different forms:
- radio buttons if
input_style => 'long'
orinput_style => 'medium'
andmultiple => 0
. - check boxes if
input_style => 'long'
orinput_style => 'medium'
andmultiple => 1
. - select box if
input_style => 'short'
.
When input_style => 'long'
is used both names and descriptions for each option will be displayed with radio buttons / check boxes. For input_style => 'medium'
only names are displayed.
Inheritance
Properties
name | default | description |
input_ordered | 0 | ... |
input_rows | n/a | This property is taken from the repository configuration. |
input_style | short | ... |
input_tags | undef | ... |
options | n/a | This property is always required. |
render_option | undef | ... |
search_input_style | checkbox | ... |
search_rows | n/a | This property is taken from the repository configuration. |
Required Phrases
In addition to the standard metadata field phrases, if input_style => 'short'
or input_style => 'medium'
then the only extra phrases required are the name label for each of the options in the form:
datasetid + "_fieldopt_" + fieldname + "_" + optionname
E.g. eprint_fieldopt_ispublished_unpub
If input_style => 'long'
then further phrases are required to provide descriptions for each option, in the form:
datasetid + "_optdetails_" + fieldname + "_" + optionname
E.g. eprint_optdetails_type_book
Database
Set fields are stored in the database as
fieldname VARCHAR(255)
API
See API page.
Examples
Most basic example. (Provides options in a select box).
{ name => 'pedagogic_type', type => 'set', options => [qw( presentation activity case enquiry problem collaboration communication )], }
Provide options as radio buttons.
{ name => 'event_type', type => 'set', options => [qw( conference workshop other )], input_style => 'medium', }
Provide options as check boxes.
{ name => 'availability', multiple => 1, type => 'set', options => [qw( print electronic )], input_style => 'medium', }
Provide search form options as select box (rather than check boxes). {
name => 'pedagogic_type', type => 'set', options => [qw( presentation activity case enquiry problem collaboration communication )], search_input_style => 'short', }