You are here

function paragraphs_pack_add_field_expand in Paragraphs pack 7

Adds expand field to a paragraph bundle.

Parameters

string $bundle: A paragraph type machine_name.

$field_label: A label of the field.

Return value

array An items field instance.

File

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

Code

function paragraphs_pack_add_field_expand($bundle, $field_label) {
  $field = paragraphs_pack_get_field_expand();
  $instance = _paragraphs_pack_add_field(array(
    'bundle' => $bundle,
    'entity_type' => PP_PARAGRAPH_TYPE,
    'field_name' => $field['field_name'],
    'label' => $field_label,
    'display' => array(
      'default' => array(
        'type' => 'hidden',
      ),
      'paragraphs_editor_preview' => array(
        'type' => 'hidden',
      ),
    ),
    'widget' => array(
      'settings' => array(
        'display_label' => 0,
      ),
      'type' => 'options_onoff',
      'weight' => 3,
    ),
  ));
  return $instance;
}