You are here

function inline_entity_form_get_controller in Inline Entity Form 7

Returns the Inline Entity Form controller for the passed-in reference field.

Parameters

$instance: The instance array of the reference field.

Return value

An instantiated controller object, or FALSE if none found.

9 calls to inline_entity_form_get_controller()
inline_entity_form_autocomplete in ./inline_entity_form.module
Returns output for inline entity form autocompletes.
inline_entity_form_entity_delete in ./inline_entity_form.module
Implements hook_entity_delete().
inline_entity_form_entity_form_submit in ./inline_entity_form.module
Submits an entity form.
inline_entity_form_entity_form_validate in ./inline_entity_form.module
Validates an entity form.
inline_entity_form_field_attach_submit in ./inline_entity_form.module
Implements hook_field_attach_submit().

... See full list

File

./inline_entity_form.module, line 94
Provides a widget for inline management (creation, modification, removal) of referenced entities. The primary use case is the parent -> children one (for example, order -> line items), where the child entities are never managed outside the…

Code

function inline_entity_form_get_controller($instance) {
  $field = field_info_field($instance['field_name']);
  $type_settings = $instance['widget']['settings']['type_settings'];
  $ief_settings = inline_entity_form_settings($field, $instance);
  $entity_info = entity_get_info($ief_settings['entity_type']);

  // The current entity type is not supported, execution can't continue.
  if (!isset($entity_info['inline entity form'])) {
    return FALSE;
  }
  return new $entity_info['inline entity form']['controller']($ief_settings['entity_type'], $type_settings);
}