Tripal
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
Drupal\tripal\TripalField\TripalWidgetBase Class Reference
Inheritance diagram for Drupal\tripal\TripalField\TripalWidgetBase:
Inheritance graph
[legend]
Collaboration diagram for Drupal\tripal\TripalField\TripalWidgetBase:
Collaboration graph
[legend]

Public Member Functions

 sanitizeKey ($key)
 

Protected Member Functions

 formMultipleElements (FieldItemListInterface $items, array &$form, FormStateInterface $form_state)
 

Detailed Description

Defines the Tripal field widget base class.

Member Function Documentation

◆ formMultipleElements()

Drupal\tripal\TripalField\TripalWidgetBase::formMultipleElements ( FieldItemListInterface  $items,
array &  $form,
FormStateInterface  $form_state 
)
protected

Override Drupal's function to change the behavior of finite cardinality.

In the case of a fixed finite cardinality that is not small, e.g. 100, we don't want to display 100 fields for every delta if they are not populated. See Drupal issue https://www.drupal.org/project/drupal/issues/1156338 We will tell Drupal that it is unlimited cardinality up until the point where we actually hit the cardinality limit. Before that point, we can use the "Add another item" button in the same way as unlimited cardinality fields.

◆ sanitizeKey()

Drupal\tripal\TripalField\TripalWidgetBase::sanitizeKey (   $key)

Sanitizes a property key.

Property keys are often controlled vocabulary IDs, which is the IdSpace and accession separated by a colon. The colon is not supported by the storage backend and must be converted to an underscore. This function performs that task.

Parameters
string$keyA property key e.g. "operation:2945".
Returns
string A sanitizied string.

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