Url field
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
Contents
Description
This field works just like a Id field except that:
- It gives a validation error if it does not appear to be a valid URL.
- When rendered it is rendered as a link to the URL (unless the
render_dont_link
property is set).
Also, as URLs are liable to be more that 256 characters this field is stored as a LONGTEXT
field in the database.
Inheritance
Additional Properties
As for Id fields.
Required Phrases
No additional phrases beyond those required for Id fields.
Database
Url fields are stored in the database as
fieldname LONGTEXT
API
See API page.
Examples
Most basic example.
{ name => 'url', type => 'url', }
Use a bespoke render function to truncate the URL at the end if it is too long.
{ name => 'official_url', type => 'url', render_value => 'EPrints::Extras::render_url_truncate_end', }
Use Url field as a sub-field in a multiple Compound field. Limiting the width of its input field.
{ name => 'related_url', type => 'compound', multiple => 1, render_value => 'EPrints::Extras::render_related_url', fields => [ { sub_name => 'url', type => 'url', input_cols => 40, }, { sub_name => 'type', type => 'set', options => [qw( pub author org )], } ], input_boxes => 1, input_ordered => 0, }