You are here

function flexiform_get_base_entity_forms in Flexiform 7

Gets an array of all flexiforms with a given base_entity type and bundle.

Parameters

string $entity_type: The entity type of base entity.

string $bundle: The bundle of the base entity.

Return value

array An array of flexiforms.

File

./flexiform.module, line 270
Module for the Flexiform system.

Code

function flexiform_get_base_entity_forms($entity_type, $bundle = FALSE) {
  $query = new EntityFieldQuery();
  $query
    ->entityCondition('entity_type', 'flexiform');
  $query
    ->propertyCondition('base_entity', $entity_type);
  if ($bundle) {
    $query
      ->propertyCondition('base_entity_bundle', $bundle);
  }
  $entities = $query
    ->execute();
  if (empty($entities['flexiform'])) {
    return array();
  }
  return entity_load('flexiform', array_keys($entities['flexiform']));
}