Tripal
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Drupal\tripal_chado\Plugin\Field\FieldWidget\ChadoRelationshipWidgetDefault Class Reference
Inheritance diagram for Drupal\tripal_chado\Plugin\Field\FieldWidget\ChadoRelationshipWidgetDefault:
Inheritance graph
[legend]
Collaboration diagram for Drupal\tripal_chado\Plugin\Field\FieldWidget\ChadoRelationshipWidgetDefault:
Collaboration graph
[legend]

Public Member Functions

 formElement (FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state)
 
 massageFormValues (array $values, array $form, FormStateInterface $form_state)
 
- Public Member Functions inherited from Drupal\tripal_chado\TripalField\ChadoWidgetBase
 selectSettingsForm (array $form, FormStateInterface $form_state)
 
 selectSettingsSummary ()
 
- Public Member Functions inherited from Drupal\tripal\TripalField\TripalWidgetBase
 sanitizeKey ($key)
 

Static Public Member Functions

static validateAutocomplete ($element, FormStateInterface $form_state)
 
static validateRelatedRecord ($element, FormStateInterface $form_state)
 
- Static Public Member Functions inherited from Drupal\tripal_chado\TripalField\ChadoWidgetBase
static defaultSelectSettings ()
 

Protected Member Functions

 saveRelatedInitialValues (int $delta, string $field_name, int $linker_id, int $type_id, int $related_record_id, int $reverse, FormStateInterface &$form_state)
 
 handleRemove (array &$values, array $form, FormStateInterface $form_state, string $field_name, array $retained_records)
 
 markForDeletion (array &$values, $delta, $reverse, $related_record_id)
 
 preMassageFormValues (array &$values)
 
- Protected Member Functions inherited from Drupal\tripal_chado\TripalField\ChadoWidgetBase
 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)
 

Member Function Documentation

◆ formElement()

Drupal\tripal_chado\Plugin\Field\FieldWidget\ChadoRelationshipWidgetDefault::formElement ( FieldItemListInterface  $items,
  $delta,
array  $element,
array &  $form,
FormStateInterface  $form_state 
)

{}

◆ handleRemove()

Drupal\tripal_chado\Plugin\Field\FieldWidget\ChadoRelationshipWidgetDefault::handleRemove ( array &  $values,
array  $form,
FormStateInterface  $form_state,
string  $field_name,
array  $retained_records 
)
protected

Handle items removed using the "Remove" button

Parameters
array&$valuesThe submitted form values produced by the widget.
array$formThe form array definition.
\Drupal\Core\Form\FormStateInterface$form_stateThe form state.
string$field_nameThe machine name of this field.
array$retained_recordsRecords in the form state at the time of massaging
Returns
void Changes are made to the $values array

◆ markForDeletion()

Drupal\tripal_chado\Plugin\Field\FieldWidget\ChadoRelationshipWidgetDefault::markForDeletion ( array &  $values,
  $delta,
  $reverse,
  $related_record_id 
)
protected

Configures a single record so that it will be deleted by chado storage. Because both subject_id and object_id are set as "store_link", we need to have the original related record ID present in the correct one for deletion.

Parameters
array&$valuesThe values array presented by massageFormValues
int$deltaThe numeric index of the item.
int$reverseThe checkbox to reverse subject:object orientation
int$related_record_idThe non-host record, either from subject_id or object_id depending on direction
Returns
void

◆ massageFormValues()

Drupal\tripal_chado\Plugin\Field\FieldWidget\ChadoRelationshipWidgetDefault::massageFormValues ( array  $values,
array  $form,
FormStateInterface  $form_state 
)

◆ preMassageFormValues()

Drupal\tripal_chado\Plugin\Field\FieldWidget\ChadoRelationshipWidgetDefault::preMassageFormValues ( array &  $values)
protected

Convert the values from the widget form fields into an updated array containing the items that are expected by the field type.

Parameters
array&$valuesThe values array passed to massageFormValues
Returns
void

◆ saveRelatedInitialValues()

Drupal\tripal_chado\Plugin\Field\FieldWidget\ChadoRelationshipWidgetDefault::saveRelatedInitialValues ( int  $delta,
string  $field_name,
int  $linker_id,
int  $type_id,
int  $related_record_id,
int  $reverse,
FormStateInterface &  $form_state 
)
protected

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.

Parameters
int$deltaThe numeric index of the item.
string$field_nameThe 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_idThe primary key value of the record in the linking table.
int$type_idThe cvterm_id of the relationship type
int$related_record_idThe ID of related record
int$reverseThe checkbox to reverse subject:object orientation
FormStateInterface&$form_stateThe current form state.

◆ validateAutocomplete()

static Drupal\tripal_chado\Plugin\Field\FieldWidget\ChadoRelationshipWidgetDefault::validateAutocomplete (   $element,
FormStateInterface  $form_state 
)
static

Form element validation handler for the CV term field

Parameters
array$elementThe form element being validated
\Drupal\Core\Form\FormStateInterface$form_stateThe form state of the (entire) configuration form

Reimplemented from Drupal\tripal_chado\TripalField\ChadoWidgetBase.

◆ validateRelatedRecord()

static Drupal\tripal_chado\Plugin\Field\FieldWidget\ChadoRelationshipWidgetDefault::validateRelatedRecord (   $element,
FormStateInterface  $form_state 
)
static

Form element validation handler for the related record field

Parameters
array$elementThe form element being validated
\Drupal\Core\Form\FormStateInterface$form_stateThe form state of the (entire) configuration form

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