field_test_entity_test_load

Versions
7
field_test_entity_test_load($ftid, $ftvid = NULL)

Loads a test_entity.

Parameters

$ftid The id of the entity to load.

$ftvid (Optional) The revision id of the entity to load. If not specified, the current revision will be used.

Return value

The loaded entity.

Code

modules/field/tests/field_test.entity.inc, line 153

<?php
function field_test_entity_test_load($ftid, $ftvid = NULL) {
  // Load basic strucure.
  $query = db_select('test_entity', 'fte', array())
    ->fields('fte')
    ->condition('ftid', $ftid);
  if ($ftvid) {
    $query->condition('ftvid', $ftvid);
  }
  $entities = $query->execute()->fetchAllAssoc('ftid');

  // Attach fields.
  if ($ftvid) {
    field_attach_load_revision('test_entity', $entities);
  }
  else {
    field_attach_load('test_entity', $entities);
  }

  return $entities[$ftid];
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.