You are here

function relation_type_ensure_instance in Relation 7

Make sure the instance exists for this type.

2 calls to relation_type_ensure_instance()
relation_get_types in ./relation.module
Loads a relation type (bundle), or all relation bundles.
relation_type_save in ./relation.module
Saves a relation bundle.

File

./relation.module, line 299
Describes relations between entities.

Code

function relation_type_ensure_instance($type) {
  if (!drupal_static('relation_install') && !field_info_instance('relation', 'endpoints', $type)) {
    $instance = array(
      'field_name' => 'endpoints',
      'entity_type' => 'relation',
      'bundle' => $type,
    );
    field_create_instance($instance);
    field_info_instance('relation', 'endpoints', $type);
  }
}