|
Tripal
|


Public Member Functions | |
| addTypes (string $field_name, array $types) | |
| removeTypes (string $field_name, array $types) | |
| getTypes () | |
| getPropertyType (string $field_name, string $key) | |
| addFieldDefinition (string $field_name, object $field_definition) | |
| getFieldDefinition (string $field_name) | |
| getStoredTypes () | |
| getNonStoredTypes () | |
| getStoredValues () | |
| insertValues (&$values) | |
| updateValues (&$values) | |
| loadValues (&$values, bool $ignore_cached_fields=TRUE) | |
| deleteValues ($values) | |
| findValues ($values) | |
| validateValues ($values) | |
| markPropertiesForCaching (string $field_name, array &$prop_types) | |
| isDrupalStoreByFieldNameKey (string $field_name, string $key, object|null $property_type=NULL) | |
| publishForm ($form, FormStateInterface &$form_state) | |
| publishFormValidate ($form, FormStateInterface &$form_state) | |
| publishFromSubmit ($form, FormStateInterface &$form_state) | |
Defines an interface for tripal storage plugins.
| Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface::addFieldDefinition | ( | string | $field_name, |
| object | $field_definition | ||
| ) |
Stores the field definition for a given field.
NOTE: the definition for every field mentioned in the values array of an insert/update/load/find/deleteValues() method must be added using this function before the *Values() method can be called.
| string | $field_name | The name of the field based on its annotation 'id'. |
| object | $field_definition | The field configuration object. This can be an instance of: \Drupal\field\Entity\FieldStorageConfig or \Drupal\field\Entity\FieldConfig. |
Implemented in Drupal\tripal\TripalStorage\TripalStorageBase, and Drupal\tripal_chado\Plugin\TripalStorage\ChadoStorage.
| Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface::addTypes | ( | string | $field_name, |
| array | $types | ||
| ) |
Adds the given array of new property types to this tripal storage plugin.
| string | $field_name | The name of the field the properties belong to. |
| array | $types | Array of \Drupal\tripal\TripalStorage\StoragePropertyTypeBase objects. |
Implemented in Drupal\tripal\Plugin\TripalStorage\DrupalSqlStorage, and Drupal\tripal\TripalStorage\TripalStorageBase.
| Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface::deleteValues | ( | $values | ) |
Deletes the given array of property values from this tripal storage plugin.
| array | $values | Array of \Drupal\tripal\TripalStorage\StoragePropertyValue objects. |
Implemented in Drupal\tripal\Plugin\TripalStorage\DrupalSqlStorage, and Drupal\tripal_chado\Plugin\TripalStorage\ChadoStorage.
| Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface::findValues | ( | $values | ) |
Finds all property values for this backend instance based on $values.
| array | $values | Associative array 5-levels deep. The 1st level is the field name (e.g. ChadoOrganismDefault). The 2nd level is the delta value (e.g. 0). The 3rd level is a field key name (i.e. record_id + value). The 4th level must contain the following three keys/value pairs
|
Implemented in Drupal\tripal\Plugin\TripalStorage\DrupalSqlStorage.
| Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface::getFieldDefinition | ( | string | $field_name | ) |
Retrieves the stored field definition of a given field.
| string | $field_name | The name of the field based on its annotation 'id'. |
Implemented in Drupal\tripal\TripalStorage\TripalStorageBase.
| Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface::getNonStoredTypes | ( | ) |
Returns a list of property types that should not be stored in Drupal.
This is the inverse of the getStoredTypes() method. It's needed because all field property types have a column in the Drupal table. However, the "Stored" ones save the value both in Drupal and in the storage backend and the "unstored" ones save an empty value in Drupal that is populated on load by the storage backend.
Implemented in Drupal\tripal\Plugin\TripalStorage\DrupalSqlStorage, and Drupal\tripal_chado\Plugin\TripalStorage\ChadoStorage.
| Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface::getPropertyType | ( | string | $field_name, |
| string | $key | ||
| ) |
Returns a single propertyType object based on the parameters.
| string | $field_name | The name of the field the properties belong to. |
| string | $key | The key of the property type to return. |
Implemented in Drupal\tripal\TripalStorage\TripalStorageBase.
| Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface::getStoredTypes | ( | ) |
Returns a list of property types that should be stored.
In order to link data in the storage backend, the storage system must link the record in someway with Drupal entities. This most likely happens in tables in the Drupal schema (usually the public schema). This function should return the list of properties that must be stored in order to uniquely identify an entity in the datastore.
Implemented in Drupal\tripal\Plugin\TripalStorage\DrupalSqlStorage, and Drupal\tripal_chado\Plugin\TripalStorage\ChadoStorage.
| Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface::getStoredValues | ( | ) |
Returns a list of property values for stored types.
This function returns an array of property value objects that correspond to the types returned by getStoredTypes().
| Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface::getTypes | ( | ) |
Returns a list of all property types added to this storage plugin type.
WARNING! This could be a very expensive call!
Implemented in Drupal\tripal\TripalStorage\TripalStorageBase.
| Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface::insertValues | ( | & | $values | ) |
Inserts values in the field data store.
The record Ids of the inserted records will be set in the property value objects.
| array | $values | Associative array 5-levels deep. The 1st level is the field name (e.g. ChadoOrganismDefault). The 2nd level is the delta value (e.g. 0). The 3rd level is a field key name (i.e. record_id + value). The 4th level must contain the following three keys/value pairs
|
Implemented in Drupal\tripal\Plugin\TripalStorage\DrupalSqlStorage, and Drupal\tripal_chado\Plugin\TripalStorage\ChadoStorage.
| Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface::isDrupalStoreByFieldNameKey | ( | string | $field_name, |
| string | $key, | ||
| object|null | $property_type = NULL |
||
| ) |
Check if a single field property should be cached in the Drupal tables.
This interacts with tripal_entity_type.default_cache_backend_field_values setting in the base implementation of this method.
WARNING: This method should only be called after the property type for this field.key combo has been added.
| string | $field_name | The name of the field thhe property to check is part of. |
| string | $key | The storage property key to check. |
| object | null | $property_type | An instance of the propertyType to be checked. Optional. If not provided it will be looked up by the field name and key. |
Implemented in Drupal\tripal\TripalStorage\TripalStorageBase, and Drupal\tripal_chado\Plugin\TripalStorage\ChadoStorage.
| Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface::loadValues | ( | & | $values, |
| bool | $ignore_cached_fields = TRUE |
||
| ) |
Loads the values of the field data store.
| array | $values | Associative array 5-levels deep. The 1st level is the field name (e.g. ChadoOrganismDefault). The 2nd level is the delta value (e.g. 0). The 3rd level is a field key name (i.e. record_id + value). The 4th level must contain the following three keys/value pairs
|
| bool | $ignore_cached_fields | If TRUE then values from fully cached fields should be ignored as they will be loaded by Drupal; if FALSE then load them from the tripal storage backend. |
Implemented in Drupal\tripal\Plugin\TripalStorage\DrupalSqlStorage, and Drupal\tripal_chado\Plugin\TripalStorage\ChadoStorage.
| Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface::markPropertiesForCaching | ( | string | $field_name, |
| array & | $prop_types | ||
| ) |
Marks which properties should be stored in the Drupal field tables.
Uses isDrupalStoreByFieldNameKey() to mark each property type as whether it should be cached in the Drupal tables or not. This should be done before calling TripalEntity::tripalClear() on these property types.
| string | $field_name | The name of the field that the following property types are part of. |
| array | $prop_types | Array of \Drupal\tripal\TripalStorage\StoragePropertyType objects. |
Implemented in Drupal\tripal\TripalStorage\TripalStorageBase.
| Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface::publishForm | ( | $form, | |
| FormStateInterface & | $form_state | ||
| ) |
Provides form elements to be added to the Tripal entity publish form.
| array | $form | The form array definition. |
| \Drupal\Core\Form\FormStateInterface | $form_state | The form state object. |
Implemented in Drupal\tripal\TripalStorage\TripalStorageBase, and Drupal\tripal_chado\Plugin\TripalStorage\ChadoStorage.
| Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface::publishFormValidate | ( | $form, | |
| FormStateInterface & | $form_state | ||
| ) |
Handles validation of the publish form elements.
| array | $form | The form array definition. |
| \Drupal\Core\Form\FormStateInterface | $form_state | The form state object. |
Implemented in Drupal\tripal\TripalStorage\TripalStorageBase.
| Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface::publishFromSubmit | ( | $form, | |
| FormStateInterface & | $form_state | ||
| ) |
Handles submission of the form elements for the storage backend.
| array | $form | The form array definition. |
| \Drupal\Core\Form\FormStateInterface | $form_state | The form state object. |
Implemented in Drupal\tripal\TripalStorage\TripalStorageBase.
| Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface::removeTypes | ( | string | $field_name, |
| array | $types | ||
| ) |
Removes the given array of property types from this tripal storage plugin.
| string | $field_name | The name of the field the properties belong to. |
| array | $types | Array of \Drupal\tripal\TripalStorage\StoragePropertyTypeBase objects. |
Implemented in Drupal\tripal\TripalStorage\TripalStorageBase.
| Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface::updateValues | ( | & | $values | ) |
Updates values in the field data store.
| array | $values | Associative array 5-levels deep. The 1st level is the field name (e.g. ChadoOrganismDefault). The 2nd level is the delta value (e.g. 0). The 3rd level is a field key name (i.e. record_id + value). The 4th level must contain the following three keys/value pairs
|
Implemented in Drupal\tripal\Plugin\TripalStorage\DrupalSqlStorage, and Drupal\tripal_chado\Plugin\TripalStorage\ChadoStorage.
| Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface::validateValues | ( | $values | ) |
Performs validation checks on values.
| array | $values | Array of \Drupal\tripal\TripalStorage\StoragePropertyValue objects. |
Implemented in Drupal\tripal\Plugin\TripalStorage\DrupalSqlStorage, and Drupal\tripal_chado\Plugin\TripalStorage\ChadoStorage.