You are here

function _entity_background_add_field in Entity background 7

Adds/Create field instance of PP_PARAGRAPH_TYPE.

Helper function.

Parameters

type $entity_type: An entity type for the instance.

array $instance: An array of instance settings.

Return value

array An field instance.

6 calls to _entity_background_add_field()
entity_background_add_field_color in includes/entity_background.fields_crud.inc
Creates color field instance.
entity_background_add_field_eb_background in includes/entity_background.fields_crud.inc
Creates eb_background field instance.
entity_background_add_field_eb_selection in includes/entity_background.fields_crud.inc
Creates eb_selection field instance.
entity_background_add_field_image in includes/entity_background.fields_crud.inc
Creates image field instance.
entity_background_add_field_list_text in includes/entity_background.fields_crud.inc
Creates list text field instance.

... See full list

File

includes/entity_background.fields_crud.inc, line 405
Fields CRUD functions.

Code

function _entity_background_add_field($entity_type, $instance) {

  // Check if the instance exists already.
  $instance_info = field_info_instance($entity_type, $instance['field_name'], $instance['bundle']);
  if (empty($instance_info)) {
    field_create_instance($instance);
  }
  return $instance_info;
}