Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('taxonomy_term');
     // Create the default tags vocabulary.
     $vocabulary = Vocabulary::create(['name' => 'Tags', 'vid' => 'tags']);
     $vocabulary->save();
     $this->vocab = $vocabulary;
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('user');
     $this->installEntitySchema('node');
     $node_type = NodeType::create(['type' => 'page', 'name' => 'Basic page', 'description' => "Use <em>basic pages</em> for your static content, such as an 'About us' page."]);
     $node_type->save();
     $node_type = NodeType::create(['type' => 'article', 'name' => 'Article', 'description' => "Use <em>articles</em> for time-sensitive content like news, press releases or blog posts."]);
     $node_type->save();
 }
Ejemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('node');
     $this->installEntitySchema('user');
     $this->installEntitySchema('comment');
     $this->installSchema('comment', ['comment_entity_statistics']);
     $node_type = NodeType::create(['type' => 'page', 'name' => t('Page')]);
     $node_type->save();
     $this->installConfig(['comment']);
     $this->addDefaultCommentField('node', 'page');
 }
Ejemplo n.º 4
0
 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('user');
     $this->installEntitySchema('node');
     // Create the article content type with a text field.
     $node_type = NodeType::create(['type' => 'article']);
     $node_type->save();
     $field_storage = FieldStorageConfig::create(['field_name' => 'test_field', 'entity_type' => 'node', 'type' => 'text']);
     $field_storage->save();
     $field = FieldConfig::create(['field_name' => 'test_field', 'entity_type' => 'node', 'bundle' => 'article', 'label' => 'Test field']);
     $field->save();
     $this->testFormat = FilterFormat::create(['format' => 'test', 'weight' => 1, 'filters' => ['filter_html_escape' => ['status' => TRUE]]]);
     $this->testFormat->save();
 }
Ejemplo n.º 5
0
 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('user');
     $this->installEntitySchema('node');
     // Create the article content type with a text field.
     $node_type = NodeType::create(['type' => 'article']);
     $node_type->save();
     $field_storage = FieldStorageConfig::create(['field_name' => 'test_field', 'entity_type' => 'node', 'type' => 'text']);
     $field_storage->save();
     $field = FieldConfig::create(['field_name' => 'test_field', 'entity_type' => 'node', 'bundle' => 'article', 'label' => 'Test field']);
     $field->save();
     $view_mode = EntityViewMode::create(['id' => 'node.token', 'targetEntityType' => 'node']);
     $view_mode->save();
     $entity_display = entity_get_display('node', 'article', 'token');
     $entity_display->setComponent('test_field', ['type' => 'text_default']);
     $entity_display->save();
 }
Ejemplo n.º 6
0
 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('user');
     $this->installEntitySchema('node');
     $this->installEntitySchema('taxonomy_term');
     // Create the article content type with a text field.
     $node_type = NodeType::create(['type' => 'article']);
     $node_type->save();
     $field_storage = FieldStorageConfig::create(['field_name' => 'test_field', 'entity_type' => 'node', 'type' => 'text']);
     $field_storage->save();
     $field = FieldConfig::create(['field_name' => 'test_field', 'entity_type' => 'node', 'bundle' => 'article', 'label' => 'Test field']);
     $field->save();
     // Create a reference field with the same name on user.
     $field_storage = FieldStorageConfig::create(['field_name' => 'test_field', 'entity_type' => 'user', 'type' => 'entity_reference']);
     $field_storage->save();
     $field = FieldConfig::create(['field_name' => 'test_field', 'entity_type' => 'user', 'bundle' => 'user', 'label' => 'Test field']);
     $field->save();
     $this->testFormat = FilterFormat::create(['format' => 'test', 'weight' => 1, 'filters' => ['filter_html_escape' => ['status' => TRUE]]]);
     $this->testFormat->save();
     // Create a multi-value list_string field.
     $field_storage = FieldStorageConfig::create(['field_name' => 'test_list', 'entity_type' => 'node', 'type' => 'list_string', 'cardinality' => 2, 'settings' => ['allowed_values' => ['key1' => 'value1', 'key2' => 'value2']]]);
     $field_storage->save();
     $this->field = FieldConfig::create(['field_name' => 'test_list', 'entity_type' => 'node', 'bundle' => 'article'])->save();
     // Add an untranslatable node reference field.
     FieldStorageConfig::create(['field_name' => 'test_reference', 'type' => 'entity_reference', 'entity_type' => 'node', 'settings' => ['target_type' => 'node'], 'translatable' => FALSE])->save();
     FieldConfig::create(['field_name' => 'test_reference', 'entity_type' => 'node', 'bundle' => 'article', 'label' => 'Test reference'])->save();
     // Add an untranslatable taxonomy term reference field.
     $this->vocabulary = $this->createVocabulary();
     FieldStorageConfig::create(['field_name' => 'test_term_reference', 'type' => 'entity_reference', 'entity_type' => 'node', 'settings' => ['target_type' => 'taxonomy_term'], 'translatable' => FALSE])->save();
     FieldConfig::create(['field_name' => 'test_term_reference', 'entity_type' => 'node', 'bundle' => 'article', 'label' => 'Test term reference', 'settings' => ['handler' => 'default:taxonomy_term', 'handler_settings' => ['target_bundles' => [$this->vocabulary->id() => $this->vocabulary->id()]]]])->save();
     // Add a field to terms of the created vocabulary.
     $storage = FieldStorageConfig::create(['field_name' => 'term_field', 'entity_type' => 'taxonomy_term', 'type' => 'text']);
     $storage->save();
     $field = FieldConfig::create(['field_name' => 'term_field', 'entity_type' => 'taxonomy_term', 'bundle' => $this->vocabulary->id()]);
     $field->save();
     // Add a second language.
     $language = ConfigurableLanguage::create(['id' => 'de', 'label' => 'German']);
     $language->save();
 }
Ejemplo n.º 7
0
 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('file');
 }