function paragraphs_pack_add_field_body in Paragraphs pack 7
Adds body 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.
2 calls to paragraphs_pack_add_field_body()
- ParagraphsPackTestCase::testParagraphsPackFieldBodyInstanceCreation in tests/
paragraphs_pack.test - Test function for field body instance creation.
- paragraphs_pack_content_install in modules/
paragraphs_pack_content/ paragraphs_pack_content.install - Implements hook_install().
File
- includes/
paragraphs_pack.fields_crud.inc, line 79 - Fields CRUD functions.
Code
function paragraphs_pack_add_field_body($bundle, $field_label) {
$field = paragraphs_pack_get_field_body();
$instance = _paragraphs_pack_add_field(array(
'field_name' => $field['field_name'],
'entity_type' => PP_PARAGRAPH_TYPE,
'bundle' => $bundle,
'label' => $field_label,
'widget' => array(
'module' => 'text',
'settings' => array(
'rows' => 5,
),
'type' => 'text_textarea',
),
'settings' => array(
'display_summary' => TRUE,
),
'display' => array(
'default' => array(
'label' => 'hidden',
'module' => 'text',
'settings' => array(),
'type' => 'text_default',
),
'paragraphs_editor_preview' => array(
'label' => 'hidden',
'module' => 'text',
'settings' => array(),
'type' => 'text_default',
),
),
));
return $instance;
}