Tripal
Public Member Functions | Protected Attributes | List of all members
Drupal\tripal\Services\TripalTokenParser Class Reference

Public Member Functions

 getBunde ()
 
 getValues ()
 
 getEntity ()
 
 getFieldNames ()
 
 setEntity (TripalEntity $entity)
 
 addFieldValue ($field_name, string $key, $value)
 
 replaceTokens (array $tokenized_strings)
 

Protected Attributes

 $bundle = NULL
 
 $entity = NULL
 
 $fields = []
 
 $values = []
 

Member Function Documentation

◆ addFieldValue()

Drupal\tripal\Services\TripalTokenParser::addFieldValue (   $field_name,
string  $key,
  $value 
)

Adds the field values that should be used for replacement.

Parameters
string$field_nameThe name of the field that the value belongs to
StoragePropertyValue$valueThe property values

◆ getBunde()

Drupal\tripal\Services\TripalTokenParser::getBunde ( )

Returns bundle object given to the parser.

Returns
\Drupal\tripal\Entity\TripalEntityType

◆ getEntity()

Drupal\tripal\Services\TripalTokenParser::getEntity ( )

Returns the entity given to the parser.

Returns
\Drupal\tripal\Entity\TripalEntity

◆ getFieldNames()

Drupal\tripal\Services\TripalTokenParser::getFieldNames ( )

Returns the names of the fields that have been added.

Returns
array

◆ getValues()

Drupal\tripal\Services\TripalTokenParser::getValues ( )

Returns the array of values given to the parser.

Returns
array

◆ replaceTokens()

Drupal\tripal\Services\TripalTokenParser::replaceTokens ( array  $tokenized_strings)

Replaces the tokens with field values within the provided strings.

Parameters
array$tokenized_stringsAnn array of strings with field names as tokens. Field name should be surrounded by square brackets.
Returns
array An array with all of the strings from the input $tokenized_strings array but with field tokens replaced with approprivate values.

◆ setEntity()

Drupal\tripal\Services\TripalTokenParser::setEntity ( TripalEntity  $entity)
Parameters
TripalEntity$entity

Member Data Documentation

◆ $bundle

Drupal tripal Entity TripalEntityType Drupal\tripal\Services\TripalTokenParser::$bundle = NULL
protected

The content type object.

◆ $fields

array Drupal\tripal\Services\TripalTokenParser::$fields = []
protected

An array of field instances.

◆ $values

array Drupal\tripal\Services\TripalTokenParser::$values = []
protected

An array of field values indexed first by field name then by property key.


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