You are here

function _paragraphs_pack_add_field in Paragraphs pack 7

Adds/Create field instance of PP_PARAGRAPH_TYPE.

Helper function.

Parameters

array $instance: An array of instance settings.

Return value

array An instance.

7 calls to _paragraphs_pack_add_field()
paragraphs_pack_add_field_body in includes/paragraphs_pack.fields_crud.inc
Adds body field to a paragraph bundle.
paragraphs_pack_add_field_expand in includes/paragraphs_pack.fields_crud.inc
Adds expand field to a paragraph bundle.
paragraphs_pack_add_field_file in includes/paragraphs_pack.fields_crud.inc
Adds file field to a paragraph bundle.
paragraphs_pack_add_field_image in includes/paragraphs_pack.fields_crud.inc
Adds image field to a paragraph bundle.
paragraphs_pack_add_field_items in includes/paragraphs_pack.fields_crud.inc
Adds items field to a paragraph bundle.

... See full list

File

includes/paragraphs_pack.fields_crud.inc, line 474
Fields CRUD functions.

Code

function _paragraphs_pack_add_field($instance) {

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