You are here

protected function TextWithSummaryItemTest::createField in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/text/src/Tests/TextWithSummaryItemTest.php \Drupal\text\Tests\TextWithSummaryItemTest::createField()

Creates a text_with_summary field storage and field.

Parameters

string $entity_type: Entity type for which the field should be created.

1 call to TextWithSummaryItemTest::createField()
TextWithSummaryItemTest::testCrudAndUpdate in core/modules/text/src/Tests/TextWithSummaryItemTest.php
Tests processed properties.

File

core/modules/text/src/Tests/TextWithSummaryItemTest.php, line 99
Contains \Drupal\text\Tests\TextWithSummaryItemTest.

Class

TextWithSummaryItemTest
Tests using entity fields of the text summary field type.

Namespace

Drupal\text\Tests

Code

protected function createField($entity_type) {

  // Create a field .
  $this->fieldStorage = entity_create('field_storage_config', array(
    'field_name' => 'summary_field',
    'entity_type' => $entity_type,
    'type' => 'text_with_summary',
    'settings' => array(
      'max_length' => 10,
    ),
  ));
  $this->fieldStorage
    ->save();
  $this->field = entity_create('field_config', array(
    'field_storage' => $this->fieldStorage,
    'bundle' => $entity_type,
  ));
  $this->field
    ->save();
}