Пример #1
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->drupalCreateContentType(array('type' => 'page', 'name' => t('Basic page')));
     // Add comment field to page node type.
     $this->addDefaultCommentField('node', 'page');
 }
Пример #2
0
 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     $this->drupalCreateContentType(array('type' => 'page', 'name' => t('Basic page')));
     // Add comment field to page node type.
     $this->container->get('comment.manager')->addDefaultField('node', 'page');
 }
Пример #3
0
 protected function setUp()
 {
     parent::setUp();
     // Create two content types. One will have an autocomplete tagging field,
     // and one won't.
     $this->nodeTypeWithTags = $this->drupalCreateContentType();
     $this->nodeTypeWithoutTags = $this->drupalCreateContentType();
     // Create the vocabulary for the tag field.
     $this->tagVocabulary = entity_create('taxonomy_vocabulary', array('name' => 'Views testing tags', 'vid' => 'views_testing_tags'));
     $this->tagVocabulary->save();
     // Create the tag field itself.
     $this->tagFieldName = 'field_views_testing_tags';
     $handler_settings = array('target_bundles' => array($this->tagVocabulary->id() => $this->tagVocabulary->id()), 'auto_create' => TRUE);
     $this->createEntityReferenceField('node', $this->nodeTypeWithTags->id(), $this->tagFieldName, NULL, 'taxonomy_term', 'default', $handler_settings, FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED);
     entity_get_form_display('node', $this->nodeTypeWithTags->id(), 'default')->setComponent($this->tagFieldName, array('type' => 'entity_reference_autocomplete_tags'))->save();
     entity_get_display('node', $this->nodeTypeWithTags->id(), 'default')->setComponent($this->tagFieldName, array('type' => 'entity_reference_label', 'weight' => 10))->save();
     entity_get_display('node', $this->nodeTypeWithTags->id(), 'teaser')->setComponent('field_views_testing_tags', array('type' => 'entity_reference_label', 'weight' => 10))->save();
 }
Пример #4
0
 function setUp()
 {
     parent::setUp();
     // Create two content types. One will have an autocomplete tagging field,
     // and one won't.
     $this->node_type_with_tags = $this->drupalCreateContentType();
     $this->node_type_without_tags = $this->drupalCreateContentType();
     // Create the vocabulary for the tag field.
     $this->tag_vocabulary = entity_create('taxonomy_vocabulary', array('name' => 'Views testing tags', 'vid' => 'views_testing_tags'));
     $this->tag_vocabulary->save();
     // Create the tag field itself.
     $this->tag_field_name = 'field_views_testing_tags';
     $this->tag_field_storage = entity_create('field_storage_config', array('name' => $this->tag_field_name, 'entity_type' => 'node', 'type' => 'taxonomy_term_reference', 'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED, 'settings' => array('allowed_values' => array(array('vocabulary' => $this->tag_vocabulary->id(), 'parent' => 0)))));
     $this->tag_field_storage->save();
     // Create an instance of the tag field on one of the content types, and
     // configure it to display an autocomplete widget.
     $this->tag_instance = array('field_storage' => $this->tag_field_storage, 'bundle' => $this->node_type_with_tags->type);
     entity_create('field_instance_config', $this->tag_instance)->save();
     entity_get_form_display('node', $this->node_type_with_tags->type, 'default')->setComponent('field_views_testing_tags', array('type' => 'taxonomy_autocomplete'))->save();
     entity_get_display('node', $this->node_type_with_tags->type, 'default')->setComponent('field_views_testing_tags', array('type' => 'taxonomy_term_reference_link', 'weight' => 10))->save();
     entity_get_display('node', $this->node_type_with_tags->type, 'teaser')->setComponent('field_views_testing_tags', array('type' => 'taxonomy_term_reference_link', 'weight' => 10))->save();
 }
Пример #5
0
 protected function setUp()
 {
     parent::setUp();
     $this->drupalPlaceBlock('page_title_block');
 }