Tripal
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
Drupal\tripal\TripalStorage\TripalStorageBase Class Reference
Inheritance diagram for Drupal\tripal\TripalStorage\TripalStorageBase:
Inheritance graph
[legend]
Collaboration diagram for Drupal\tripal\TripalStorage\TripalStorageBase:
Collaboration graph
[legend]

Public Member Functions

 __construct (array $configuration, $plugin_id, $plugin_definition, TripalLogger $logger)
 
- Public Member Functions inherited from Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface
 getStoredTypes ()
 
 getStoredValues ()
 
 insertValues (&$values)
 
 updateValues (&$values)
 
 loadValues (&$values)
 
 deleteValues ($values)
 
 findValues ($values)
 
 validateValues ($values)
 

Static Public Member Functions

static create (ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition)
 

Protected Attributes

 $logger
 
 $field_definitions = []
 
 $property_types = []
 
 addFieldDefinition (string $field_name, object $field_definition)
 
 getFieldDefinition (string $field_name)
 
 addTypes (string $field_name, array $types)
 
 getTypes ()
 
 getPropertyType (string $field_name, string $key)
 
 removeTypes (string $field_name, array $types)
 
 publishForm ($form, FormStateInterface &$form_state)
 
 publishFormValidate ($form, FormStateInterface &$form_state)
 
 publishFromSubmit ($form, FormStateInterface &$form_state)
 
 cloneValues ($values)
 
 addEmptyValuesItem (&$values, $field_name)
 

Constructor & Destructor Documentation

◆ __construct()

Drupal\tripal\TripalStorage\TripalStorageBase::__construct ( array  $configuration,
  $plugin_id,
  $plugin_definition,
TripalLogger  $logger 
)

Implements __contruct().

Since we have implemented the ContainerFactoryPluginInterface, the constructor will be passed additional parameters added by the create() function. This allows our plugin to use dependency injection without our plugin manager service needing to worry about it.

Parameters
array$configuration
string$plugin_id
mixed$plugin_definition
\Drupal\tripal\Services\TripalLogger$logger

Member Function Documentation

◆ addEmptyValuesItem()

Drupal\tripal\TripalStorage\TripalStorageBase::addEmptyValuesItem ( $values,
  $field_name 
)
protected

A helper function to add a new item for a field by cloning delta 0.

Parameters
array$valuesAn array of property values.
string$field_nameThe name of the field to addd an item to.

◆ addFieldDefinition()

Drupal\tripal\TripalStorage\TripalStorageBase::addFieldDefinition ( string  $field_name,
object  $field_definition 
)

◆ addTypes()

Drupal\tripal\TripalStorage\TripalStorageBase::addTypes ( string  $field_name,
array  $types 
)

◆ cloneValues()

Drupal\tripal\TripalStorage\TripalStorageBase::cloneValues (   $values)
protected

A helper function to clone a values array.

Parameters
array$valuesAn array of property values.

◆ create()

static Drupal\tripal\TripalStorage\TripalStorageBase::create ( ContainerInterface  $container,
array  $configuration,
  $plugin_id,
  $plugin_definition 
)
static

Implements ContainerFactoryPluginInterface->create().

Since we have implemented the ContainerFactoryPluginInterface this static function will be called behind the scenes when a Plugin Manager uses createInstance(). Specifically this method is used to determine the parameters to pass to the contructor.

Parameters
\Symfony\Component\DependencyInjection\ContainerInterface$container
array$configuration
string$plugin_id
mixed$plugin_definition
Returns
static

Reimplemented in Drupal\tripal_chado\Plugin\TripalStorage\ChadoStorage.

◆ getFieldDefinition()

Drupal\tripal\TripalStorage\TripalStorageBase::getFieldDefinition ( string  $field_name)

◆ getPropertyType()

Drupal\tripal\TripalStorage\TripalStorageBase::getPropertyType ( string  $field_name,
string  $key 
)

◆ getTypes()

Drupal\tripal\TripalStorage\TripalStorageBase::getTypes ( )

◆ publishForm()

Drupal\tripal\TripalStorage\TripalStorageBase::publishForm (   $form,
FormStateInterface &  $form_state 
)

Provides form elements to be added to the Tripal entity publish form.

Parameters
array$formThe form array definition.
\Drupal\Core\Form\FormStateInterface$form_stateThe form state object.
Returns
array A new form array definition containing the form elements to add to the publish form.

See also
\Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface::publishFrom()

Implements Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface.

Reimplemented in Drupal\tripal_chado\Plugin\TripalStorage\ChadoStorage.

◆ publishFormValidate()

Drupal\tripal\TripalStorage\TripalStorageBase::publishFormValidate (   $form,
FormStateInterface &  $form_state 
)

Handles validation of the publish form elements.

Parameters
array$formThe form array definition.
\Drupal\Core\Form\FormStateInterface$form_stateThe form state object.

See also
\Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface::publishFormValidate()

Implements Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface.

◆ publishFromSubmit()

Drupal\tripal\TripalStorage\TripalStorageBase::publishFromSubmit (   $form,
FormStateInterface &  $form_state 
)

Handles submission of the form elements for the storage backend.

Parameters
array$formThe form array definition.
\Drupal\Core\Form\FormStateInterface$form_stateThe form state object.

See also
\Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface::publishFromSubmit()

Implements Drupal\tripal\TripalStorage\Interfaces\TripalStorageInterface.

◆ removeTypes()

Drupal\tripal\TripalStorage\TripalStorageBase::removeTypes ( string  $field_name,
array  $types 
)

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