|
Tripal
|


Public Member Functions | |
| selectSettingsForm (array $form, FormStateInterface $form_state) | |
| selectSettingsSummary () | |
Public Member Functions inherited from Drupal\tripal\TripalField\TripalWidgetBase | |
| sanitizeKey ($key) | |
Static Public Member Functions | |
| static | defaultSelectSettings () |
| static | validateAutocomplete ($element, FormStateInterface $form_state) |
Protected Member Functions | |
| saveInitialValues (int $delta, string $field_name, int $linker_id, FormStateInterface &$form_state) | |
| getSelectLimit (?int $select_limit=NULL) | |
| genericSelectElement (string $pkey_column, ?int $default_id, array $options,) | |
| massageLinkingFormValues (string $fkey, array $values, FormStateInterface $form_state, string $linker_key='linker_id',) | |
| genericSelectMassageFormValues (string $pkey_id, array $values) | |
| massagePropertyFormValues (string $val, array $values, FormStateInterface $form_state, ?string $rank_term=NULL, string $linker_key='prop_id',) | |
| getMatchOperatorOptions () | |
Protected Member Functions inherited from Drupal\tripal\TripalField\TripalWidgetBase | |
| formMultipleElements (FieldItemListInterface $items, array &$form, FormStateInterface $form_state) | |
Defines the Chado field widget base class.
For linking multi-cardinality fields, this class includes the following helper methods to provide support for the "remove" button added by Drupal. To enable this support, the following need to be implemented in your widget:
|
static |
Default settings associated with the generic select element.
|
protected |
Generic select form element generator.
For a small number of values this creates a select, for many values this creates an autocomplete.
| string | $pkey_column | The name of the primary key column. |
| int | null | $default_id | The pkey_id value of the default, if one exists. |
| array | $options | 'base_table' - Chado table name 'column_name' - Column name in the base table 'type_column' - Column in base table specifying type, or single character placeholder if none exists. 'property_table' - same as base table if type is stored there 'type_id' - cvterm_id to limit by, 0 for no limiting. 'match_operator' - Either "CONTAINS" or "STARTS_WITH" 'match_limit' -Number of records that the autoselect will present 'size' - Size of the autocomplete form field 'placeholder' - Placeholder before autocomplete is filled 'select_limit' - The maximum number of records for a select. If more, then use autocomplete. Use zero if autocomplete always wanted. If NULL or empty string, then the global setting will be used. |
|
protected |
A helper for massageFormValues() where the generic autocomplete is used.
The genericSelectElement() will return an integer in the $values array when a select is used, but returns a string with an embedded id value in parentheses when the autocomplete is used. In this latter case, we need to return just the integer value. Note that if you somehow pass a text string without an embedded value, then no changes are made, however, this should be prevented by validation.
| string | $pkey_id | The name of the value to be massaged, e.g. "analysis_id". |
| array | $values | The submitted form values produced by the widget. |
|
protected |
Returns the options for the match operator.
|
protected |
Gets the select_limit value.
This finds the value by using, in order:
| ?int | $select_limit If not NULL or an empty string, use this value. |
|
protected |
Assists the massageFormValues() function for linking fields.
Specifically, a linking field is a double-hop fields where an intermediate linking table is used. This includes properly handling deletion of the record in the linking table in chado.
| string | $fkey | The foreign key column name in the linking table. Needed because it is not guaranteed to be in $values array, e.g. for dbxref. |
| array | $values | The submitted form values produced by the widget.
|
| \Drupal\Core\Form\FormStateInterface | $form_state | The form state. |
| string | $linker_key | The key used for the linking table primary key. For most fields this is "linker_id" and can be omitted, but see the synonym field for an exception. |
|
protected |
Assists the massageFormValues() function for property fields.
Specifically, a property field is a single-hop fields where the linked table contains a value. This includes properly handling deletion of the record in the linked table in chado.
| string | $val | The name that the value is stored under, i.e. 'value'. |
| array | $values | The submitted form values produced by the widget.
|
| \Drupal\Core\Form\FormStateInterface | $form_state | The form state. |
| string | $rank_term | If present, used to reset rank in values. |
| string | $linker_key | The key used for the linking table primary key. For property fields this is "prop_id" and can be omitted. |
|
protected |
Saves initial form state for context to 2+ cardinality fields.
Saves some values from the initial form state when an entity is first edited for multi-cardinality linking fields. These values are needed to support the "Remove" button.
| int | $delta | The numeric index of the item. |
| string | $field_name | The machine name of the field used for linking the info we're saving in form_state with the values submitted by the form. |
| int | $linker_id | The primary key value of the record in the linking table. |
| \Drupal\Core\Form\FormStateInterface | &$form_state | The current form state. |
| Drupal\tripal_chado\TripalField\ChadoWidgetBase::selectSettingsForm | ( | array | $form, |
| FormStateInterface | $form_state | ||
| ) |
Elements for the widget settings form for the generic select element.
| Drupal\tripal_chado\TripalField\ChadoWidgetBase::selectSettingsSummary | ( | ) |
Summary of the settings for the generic select element.
|
static |
Form element validation handler for an autocomplete field.
| array | $element | The form element being validated. |
| \Drupal\Core\Form\FormStateInterface | $form_state | The form state of the (entire) configuration form. |
Reimplemented in Drupal\tripal_chado\Plugin\Field\FieldWidget\ChadoRelationshipWidgetDefault.