Open Journal Systems  3.3.0
PKP\components\forms\Field Class Reference
Inheritance diagram for PKP\components\forms\Field:
PKP\components\forms\FieldBaseAutosuggest PKP\components\forms\FieldColor PKP\components\forms\FieldHTML PKP\components\forms\FieldOptions PKP\components\forms\FieldPubId PKP\components\forms\FieldRadioInput PKP\components\forms\FieldRichTextarea PKP\components\forms\FieldSelect PKP\components\forms\FieldText PKP\components\forms\FieldTextarea PKP\components\forms\FieldUpload

Public Member Functions

 __construct ($name, $args=array())
 
 getConfig ()
 
 getEmptyValue ()
 
 validate ()
 

Data Fields

 $component
 
 $default
 
 $description
 
 $groupId
 
 $helpSection
 
 $helpTopic
 
 $isMultilingual = false
 
 $isRequired = false
 
 $label = ''
 
 $name
 
 $showWhen
 
 $tooltip
 
 $value
 

Detailed Description

Definition at line 16 of file Field.inc.php.

Constructor & Destructor Documentation

◆ __construct()

PKP\components\forms\Field::__construct (   $name,
  $args = array() 
)

Initialize the form field

Parameters
$namestring
$argsarray [ @option label string|object @option groupId string @option isRequired boolean @option isMultilingual boolean ]

Reimplemented in PKP\components\forms\FieldRichTextarea, PKP\components\forms\FieldUploadImage, and PKP\components\forms\FieldUpload.

Definition at line 119 of file Field.inc.php.

References PKP\components\forms\Field\$name, and PKP\components\forms\Field\$value.

Member Function Documentation

◆ getConfig()

◆ getEmptyValue()

PKP\components\forms\Field::getEmptyValue ( )

Get a default empty value for this field type

The UI Library expects to receive a value property for each field. If it's a multilingual field, it expects the value property to contain keys for each locale in the form.

This function will provide a default empty value so that a form can fill in the empty values automatically.

Returns
mixed

Reimplemented in PKP\components\forms\FieldUploadImage.

Definition at line 203 of file Field.inc.php.

◆ validate()

PKP\components\forms\Field::validate ( )

Validate the field configuration

Check that no required fields are missing

Returns
boolean

Reimplemented in PKP\components\forms\FieldUpload.

Definition at line 182 of file Field.inc.php.

Referenced by PKP\components\forms\Field\getConfig().

Field Documentation

◆ $component

string Field::$component

Which UI Library component this field represents

Definition at line 21 of file Field.inc.php.

◆ $default

mixed Field::$default

A default for this field when no value is specified.

Definition at line 87 of file Field.inc.php.

Referenced by PKP\components\forms\Field\getConfig().

◆ $description

string Field::$description

Field description

Definition at line 39 of file Field.inc.php.

Referenced by PKP\components\forms\Field\getConfig().

◆ $groupId

string Field::$groupId

Which group should this field be placed in?

Definition at line 63 of file Field.inc.php.

Referenced by PKP\components\forms\Field\getConfig().

◆ $helpSection

string Field::$helpSection

Field help section. An optional anchor link to open to when loading the helpTopic.

Definition at line 57 of file Field.inc.php.

Referenced by PKP\components\forms\Field\getConfig().

◆ $helpTopic

string Field::$helpTopic

Field help topic. Refers to the /dev/docs file name without .md

Definition at line 51 of file Field.inc.php.

Referenced by PKP\components\forms\Field\getConfig().

◆ $isMultilingual

boolean Field::$isMultilingual = false

Is this field multilingual?

Definition at line 75 of file Field.inc.php.

Referenced by PKP\components\forms\Field\getConfig().

◆ $isRequired

boolean Field::$isRequired = false

Is this field required?

Definition at line 69 of file Field.inc.php.

Referenced by PKP\components\forms\Field\getConfig().

◆ $label

string object Field::$label = ''

Field label or multilingual object matching locales to labels, eg ['en_US' => 'Label', 'fr_CA' => 'Étiquette']

Definition at line 33 of file Field.inc.php.

◆ $name

◆ $showWhen

string array Field::$showWhen

Only show this field when the field named here is not empty. Match an exact value by passing an array:

$this->showWhen = ['fieldName', 'expectedValue'];

Definition at line 100 of file Field.inc.php.

Referenced by PKP\components\forms\Field\getConfig().

◆ $tooltip

string Field::$tooltip

Field tooltip

Definition at line 45 of file Field.inc.php.

Referenced by PKP\components\forms\Field\getConfig().

◆ $value

mixed Field::$value

The value of this field. If multilingual, expects a key/value array: ['en_US', => 'English value', 'fr_CA' => 'French value']

Definition at line 81 of file Field.inc.php.

Referenced by PKP\components\forms\Field\__construct(), PKP\components\forms\Field\getConfig(), and PKP\components\forms\FieldControlledVocab\mapSelected().


The documentation for this class was generated from the following file: