You are here

function paragraphs_pack_get_field_items in Paragraphs pack 7

Get/Create items field.

This field can be used only on paragraph entity type.

Parameters

string $target_type: An entity type that should be allowed as items input.

Return value

array An array containing field values.

3 calls to paragraphs_pack_get_field_items()
ParagraphsPackTestCase::testParagraphsPackFieldItemsCreation in tests/paragraphs_pack.test
Test function for field items creation.
ParagraphsPackTestCase::testParagraphsPackFieldItemsInstanceCreation in tests/paragraphs_pack.test
Test function for field items instance creation.
paragraphs_pack_add_field_items in includes/paragraphs_pack.fields_crud.inc
Adds items field to a paragraph bundle.

File

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

Code

function paragraphs_pack_get_field_items($target_type = 'node') {
  $field = _paragraphs_pack_get_field(array(
    'field_name' => PP_FIELD_ITEMS . '_' . $target_type,
    'type' => 'entityreference',
    'entity_types' => array(
      PP_PARAGRAPH_TYPE,
    ),
    'settings' => array(
      'target_type' => $target_type,
    ),
    'cardinality' => FIELD_CARDINALITY_UNLIMITED,
  ));
  return $field;
}