You are here

function paragraphs_pack_add_field_title in Paragraphs pack 7

Adds title 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.

6 calls to paragraphs_pack_add_field_title()
ParagraphsPackTestCase::testParagraphsPackFieldTitleInstanceCreation in tests/paragraphs_pack.test
Test function for field title instance creation.
paragraphs_pack_content_install in modules/paragraphs_pack_content/paragraphs_pack_content.install
Implements hook_install().
paragraphs_pack_juicebox_install in modules/paragraphs_pack_juicebox/paragraphs_pack_juicebox.install
Implements hook_install().
paragraphs_pack_node_list_install in modules/paragraphs_pack_node_list/paragraphs_pack_node_list.install
Implements hook_install().
paragraphs_pack_taxonomy_term_list_install in modules/paragraphs_pack_taxonomy_term_list/paragraphs_pack_taxonomy_term_list.install
Implements hook_install().

... See full list

File

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

Code

function paragraphs_pack_add_field_title($bundle, $field_label) {
  $field = paragraphs_pack_get_field_title();
  $instance = _paragraphs_pack_add_field(array(
    'field_name' => $field['field_name'],
    'entity_type' => PP_PARAGRAPH_TYPE,
    'bundle' => $bundle,
    'label' => $field_label,
    'widget' => array(
      'type' => 'text_textfield',
    ),
    'settings' => array(
      'text_processing' => 0,
      'user_register_form' => FALSE,
    ),
    '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;
}