Tripal
Functions
tripal.entities.api.inc File Reference

Functions

 hook_entity_create (&$entity, $entity_type)
 
 hook_bundle_create (&$bundle, $storage_args)
 
 hook_bundle_postcreate (&$bundle)
 
 hook_tripal_cron_notification ()
 
 hook_bundle_delete ($bundle)
 
 hook_tripal_default_title_format ($bundle, $available_tokens)
 
 tripal_load_entity ($entity_type, $ids=FALSE, $reset=FALSE, $field_ids=[], $cache=TRUE)
 
 tripal_load_term_entity ($values)
 
 tripal_load_vocab_entity ($values)
 
 tripal_load_bundle_entity ($values)
 
 tripal_add_notification ($title, $details, $type, $actions, $submitter_id)
 
 tripal_create_bundle ($args, $job=NULL)
 
 tripal_get_content_types ()
 
 tripal_tripal_cron_notification ()
 
 tripal_get_content_type ($bundle_name)
 
 tripal_create_bundle_fields ($bundle, $term)
 
 tripal_update_bundle_field ($field_name, $field_info, $entity_type_name, $bundle_name)
 
 tripal_get_bundle_variable ($variable_name, $bundle_id, $default=FALSE)
 
 tripal_set_bundle_variable ($variable_name, $bundle_id, $value)
 
 tripal_get_title_format ($bundle)
 
 tripal_save_title_format ($entity, $format)
 
 tripal_get_default_title_format ($bundle)
 
 tripal_get_entity_tokens ($bundle, $options=[])
 
 _tripal_get_entity_tokens_for_elements ($instance, $parent, $elements, &$tokens, $options)
 
 tripal_replace_entity_tokens ($string, &$entity, $bundle_entity=NULL)
 
 _tripal_replace_entity_tokens_for_elements ($elements, $values)
 
 theme_token_list ($tokens)
 
 tripal_entity_label ($entity)
 
 tripal_get_bundle_details ($bundle_name)
 
 _tripal_get_bundle_field_element_details ($elements, &$field_details)
 
 tripal_insert_entity ($bundle_name, $values)
 
 tripal_update_entity ($bundle_name, $values)
 
 tripal_unpublish_orphans (int $bundle_id, TripalJob $job=NULL)
 
 hook_bundle_delete_orphans (TripalBundle $bundle, array $ids, TripalJob $job=NULL)
 
 hook_bundle_find_orphans (TripalBundle $bundle, $count=FALSE, $offset=0, $limit=10)
 

Detailed Description

Provides an application programming interface (API) for working with TripalEntity content types (bundles) and their entities.

Function Documentation

◆ _tripal_get_entity_tokens_for_elements()

_tripal_get_entity_tokens_for_elements (   $instance,
  $parent,
  $elements,
$tokens,
  $options 
)

A recursive helper function to get tokens for element sub fields.

Parameters
$instanceA original field instance object.
$parentThe name of the parent. The first time this is called outside of recursion this should be the field name.
$elementsThe array of elements to process.
$tokensThe array of tokens to be added to.

◆ _tripal_replace_entity_tokens_for_elements()

_tripal_replace_entity_tokens_for_elements (   $elements,
  $values 
)

A helper function for tripal_replace_entity_tokens to get token values.

This helper function is used when the tokens are from subelements.

Parameters
$entity

◆ hook_bundle_delete_orphans()

hook_bundle_delete_orphans ( TripalBundle  $bundle,
array  $ids,
TripalJob  $job = NULL 
)

A hook for modules to delete details for orphaned entities.

This hook is called by the TripalBundleController. Modules that create entities should use this hook to clean up entities that are orphaned. The list of $ids passed should be entities who are already known to be orphaned. These IDs are found by the TripalBundleController using the results from the hook_bundle_find_orphans() function.

An implementation of this hook should not try to clean up the entity itself, but rather it should only clean up its own records used to manage the relationship between the entity and the underlying data that the module provides.

An orphaned entity can occur if the module that created the entity unknowingly lost its underlying record in its data store. Such a case could happen if someone directly removed the record from the data store outside of the module's control. This function allows each module to report if any orphans are missing for a given bundle type.

Parameters
TripalBundle$bundleA TripalBundle object for the bundle whose entities are orphaned.
array$idsA list of entity IDs known to be orphaned.
TripalJob$jobAn optional Tripal Job object. This is provided when this function is called using the Tripal Jobs system. Implementors of this hook can use the addItemsHandled() function to indicate how many entities were cleaned up.
Returns
integer The number of entities that were cleaned up.

◆ hook_bundle_find_orphans()

hook_bundle_find_orphans ( TripalBundle  $bundle,
  $count = FALSE,
  $offset = 0,
  $limit = 10 
)

A hook for modules to report on orphaned entities.

An orphaned entity can occur if the module that created the entity unknowingly lost its underlying record in its data store. Such a case could happen if someone directly removed the record from the data store outside of the module's control. This function allows each module to report if any orphans are missing for a given bundle type.

Parameters
TripalBundle$bundleA TripalBundle object for the bundle that should be checked for orphaned entities.
bool$countTRUE if the function should return only the number of orphaned entities. FALSE if the function should return the list of orphaned entities.
integer$offsetFor paging of entities set this to the offset within the total count.
integer$limitFor paging of entities set this to the total number to return.
Returns
array|bool If $count == FALSE then an array of all entity IDs that are orphaned. If $count == TRUE then a single integer count value is returned.

◆ tripal_insert_entity()

tripal_insert_entity (   $bundle_name,
  $values 
)

Is this completed? It doesn't look right and I can't find it used anywhere in the existing code.

Parameters
$bundle_nameThe name of the bundle (e.g. bio_data_xx)
unknown$values
Exceptions
Exception

◆ tripal_unpublish_orphans()

tripal_unpublish_orphans ( int  $bundle_id,
TripalJob  $job = NULL 
)

Removes orphaned entities.

An orphaned entity can occur if the module that created the entity unknowingly lost its underlying record in its data store. Such a case could happen if someone directly removed the record from the data store outside of the module's control. This function allows each module to report if any orphans are missing for a given bundle type.

Parameters
integer$bundle_idThe numeric ID of the bundle.
TripalJob$job(Optional). If this function is executed via the Tripal Jobs system then this argument is provided.

◆ tripal_update_entity()

tripal_update_entity (   $bundle_name,
  $values 
)

Are we keeping this?

Parameters
$bundle_name
$values