Difference between revisions of "Subject field"

From EPrints Documentation
Jump to: navigation, search
(Added standard sections some with content. Unhide ToC)
Line 1: Line 1:
 
{{fieldtypes}}
 
{{fieldtypes}}
__NOTOC__
+
 
 +
 
 +
== Description ==
 +
This field is like a [[Set field]] but rather than explicitly defining its set of options within the field configuration, the field configuration attribute <code>top</code> specifies the root of the [[Admin/Editorial Tools/Edit Subjects|subjects]] sub-tree to use as a set of options.
 +
 
 
== Inheritance ==
 
== Inheritance ==
 
 
* [[Metadata]]
 
* [[Metadata]]
 
** [[Set field]]
 
** [[Set field]]
 
*** [[Subject field]]
 
*** [[Subject field]]
 
== Description ==
 
  
 
== Properties ==
 
== Properties ==
 
 
As for [[set field]]s with the following differences...
 
As for [[set field]]s with the following differences...
  
Line 18: Line 18:
 
| '''input_style''' || 0 || ''as for [[set field]] but with a different default.''
 
| '''input_style''' || 0 || ''as for [[set field]] but with a different default.''
 
|-
 
|-
| '''nestids''' || 1 || ...
+
| '''nestids''' || 1 || '''Options are colon (<tt>:</tt>) separated path of sub-tree IDs rather than just the specific subject ID.'''
 
|-
 
|-
 
| '''options''' || n/a || '''This property is ''not'' inherited from [[set field]].'''
 
| '''options''' || n/a || '''This property is ''not'' inherited from [[set field]].'''
 
|-
 
|-
| '''showall''' || 0 || ...
+
| '''showall''' || 0 || '''Show all options under <code>top</code>, not just those marked as <tt>depositable</tt>.'''
 
|-
 
|-
| '''showtop''' || 0 || ...
+
| '''showtop''' || 0 || '''Show the subject option defined by <code>top</code> as well as the options underneath.'''
 
|-
 
|-
| '''top''' || subjects || ...
+
| '''top''' || subjects || '''Specifies the sub-tree of the subjects tree to get options.'''
 
|}
 
|}
  
 
== Required Phrases ==
 
== Required Phrases ==
 +
No additional phrases.  Also <code>datasetid + "_fieldopt_" + fieldname + "_" + optionname</code> phrases are not required, as these are taken from the name assigned to the subject.
 +
 +
== Database ==
 +
Namedset fields are stored in the database as
 +
fieldname VARCHAR(255)
 +
 +
== API ==
 +
See [[API:EPrints/MetaField/Subject|API page]].
  
[[Category:Documentation Needed]]
+
== Examples ==
 +
Most basic example.  Using <tt>divisions</tt> subjects tree sub-tree to provide options.
 +
{
 +
    name => 'division',
 +
    type => 'subject',
 +
    top => 'divisions',
 +
}
 +
Allow multiple subject options to be selected.
 +
{
 +
    name => 'subjects',
 +
    type => 'subject',
 +
    multiple => 1,
 +
    top => 'subjects',
 +
}
 +
Rendered value will link to corresponding listings page in <tt>subjects</tt> browse view.
 +
{
 +
    name => 'subjects',
 +
    type => 'subject',
 +
    multiple => 1,
 +
    top => 'subjects',
 +
    browse_link => 'subjects',
 +
}

Revision as of 23:59, 8 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 - Relation - Search - Secret - Set - Storable - Subject - Subobject - Text - Time - Timestamp - Url - Uuid


Description

This field is like a Set field but rather than explicitly defining its set of options within the field configuration, the field configuration attribute top specifies the root of the subjects sub-tree to use as a set of options.

Inheritance

Properties

As for set fields with the following differences...

name default description
input_style 0 as for set field but with a different default.
nestids 1 Options are colon (:) separated path of sub-tree IDs rather than just the specific subject ID.
options n/a This property is not inherited from set field.
showall 0 Show all options under top, not just those marked as depositable.
showtop 0 Show the subject option defined by top as well as the options underneath.
top subjects Specifies the sub-tree of the subjects tree to get options.

Required Phrases

No additional phrases. Also datasetid + "_fieldopt_" + fieldname + "_" + optionname phrases are not required, as these are taken from the name assigned to the subject.

Database

Namedset fields are stored in the database as

fieldname VARCHAR(255)

API

See API page.

Examples

Most basic example. Using divisions subjects tree sub-tree to provide options.

{
    name => 'division',
    type => 'subject',
    top => 'divisions',
}

Allow multiple subject options to be selected.

{
    name => 'subjects',
    type => 'subject',
    multiple => 1,
    top => 'subjects',
}

Rendered value will link to corresponding listings page in subjects browse view.

{
    name => 'subjects',
    type => 'subject',
    multiple => 1,
    top => 'subjects',
    browse_link => 'subjects',
}