作者:anatalsce
项目:en-class
function setUp()
{
parent::setUp();
$this->admin_user = $this->drupalCreateUser(array('administer taxonomy'));
$this->drupalLogin($this->admin_user);
$this->vocabulary = $this->createVocabulary();
}
作者:ravindrasingh2
项目:Drupal-8-r
protected function setUp()
{
parent::setUp();
$this->drupalLogin($this->drupalCreateUser(['administer taxonomy']));
$this->vocabulary = $this->createVocabulary();
$this->drupalPlaceBlock('local_actions_block');
}
作者:Nikola-xii
项目:d8intrane
protected function setUp()
{
parent::setUp();
$this->vocabulary = $this->createVocabulary();
// RDF mapping - term bundle.
rdf_get_mapping('taxonomy_term', $this->vocabulary->id())->setBundleMapping(array('types' => array('skos:Concept')))->setFieldMapping('name', array('properties' => array('rdfs:label', 'skos:prefLabel')))->save();
}
作者:aWEBoLab
项目:tax
protected function setUp()
{
parent::setUp();
$admin_user = $this->drupalCreateUser(array('create article content', 'administer taxonomy'));
$this->drupalLogin($admin_user);
$this->vocabulary = $this->createVocabulary();
}
作者:Wylbu
项目:g
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
$this->setupLanguages();
$this->vocabulary = $this->createVocabulary();
$this->enableTranslation();
$this->setUpTerms();
$this->setUpTermReferenceField();
}
作者:nstiela
项目:drops-
protected function setUp()
{
parent::setUp();
// Create an administrative user.
$this->drupalLogin($this->drupalCreateUser(['administer taxonomy']));
// Add some custom languages.
ConfigurableLanguage::create(array('id' => 'aa', 'label' => $this->randomMachineName()))->save();
ConfigurableLanguage::create(array('id' => 'bb', 'label' => $this->randomMachineName()))->save();
}
作者:jeroeno
项目:jeroenos_d8.mypressonline.co
/**
* {@inheritdoc}
*/
protected function setUp()
{
parent::setUp();
// Create filter format.
$restricted_html_format = entity_create('filter_format', array('format' => 'restricted_html', 'name' => 'Restricted HTML', 'filters' => array('filter_html' => array('status' => TRUE, 'weight' => -10, 'settings' => array('allowed_html' => '<p> <br /> <strong> <a> <em> <h4>')), 'filter_autop' => array('status' => TRUE, 'weight' => 0), 'filter_url' => array('status' => TRUE, 'weight' => 0), 'filter_htmlcorrector' => array('status' => TRUE, 'weight' => 10))));
$restricted_html_format->save();
// Create user then login.
$this->user = $this->drupalCreateUser(array('administer site configuration', 'access site map', 'administer menu', 'administer nodes', 'create article content', 'administer taxonomy', $restricted_html_format->getPermissionName()));
$this->drupalLogin($this->user);
}
作者:brstd
项目:gap
protected function setUp()
{
parent::setUp();
$this->drupalLogin($this->drupalCreateUser(['administer taxonomy', 'bypass node access', 'administer content types', 'administer node display']));
$this->vocabulary = $this->createVocabulary();
$this->fieldName = 'taxonomy_' . $this->vocabulary->id();
$handler_settings = array('target_bundles' => array($this->vocabulary->id() => $this->vocabulary->id()), 'auto_create' => TRUE);
$this->createEntityReferenceField('node', 'article', $this->fieldName, NULL, 'taxonomy_term', 'default', $handler_settings, FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED);
entity_get_form_display('node', 'article', 'default')->setComponent($this->fieldName, array('type' => 'options_select'))->save();
entity_get_display('node', 'article', 'default')->setComponent($this->fieldName, array('type' => 'entity_reference_label'))->save();
}
作者:Nikola-xii
项目:d8intrane
protected function setUp()
{
parent::setUp();
$this->drupalLogin($this->drupalCreateUser(['administer taxonomy', 'bypass node access']));
$this->vocabulary = $this->createVocabulary();
$this->fieldName = 'taxonomy_' . $this->vocabulary->id();
entity_create('field_storage_config', array('field_name' => $this->fieldName, 'entity_type' => 'node', 'type' => 'taxonomy_term_reference', 'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED, 'settings' => array('allowed_values' => array(array('vocabulary' => $this->vocabulary->id(), 'parent' => 0)))))->save();
entity_create('field_config', array('field_name' => $this->fieldName, 'bundle' => 'article', 'entity_type' => 'node'))->save();
entity_get_form_display('node', 'article', 'default')->setComponent($this->fieldName, array('type' => 'options_select'))->save();
entity_get_display('node', 'article', 'default')->setComponent($this->fieldName, array('type' => 'taxonomy_term_reference_link'))->save();
}
作者:aWEBoLab
项目:tax
protected function setUp()
{
parent::setUp();
// Create a tags vocabulary for the 'article' content type.
$vocabulary = Vocabulary::create(['name' => 'Tags', 'vid' => 'tags']);
$vocabulary->save();
$field_name = 'field_' . $vocabulary->id();
$handler_settings = array('target_bundles' => array($vocabulary->id() => $vocabulary->id()), 'auto_create' => TRUE);
$this->createEntityReferenceField('node', 'article', $field_name, 'Tags', 'taxonomy_term', 'default', $handler_settings, FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED);
entity_get_form_display('node', 'article', 'default')->setComponent($field_name, array('type' => 'entity_reference_autocomplete_tags'))->save();
$this->drupalLogin($this->drupalCreateUser(['administer taxonomy', 'administer nodes', 'bypass node access']));
}
作者:318i
项目:318-i
protected function setUp()
{
parent::setUp();
// Create an administrative user.
$this->drupalLogin($this->drupalCreateUser(['administer taxonomy']));
// Create a vocabulary to which the terms will be assigned.
$this->vocabulary = $this->createVocabulary();
// Add some custom languages.
foreach (array('aa', 'bb', 'cc') as $language_code) {
ConfigurableLanguage::create(array('id' => $language_code, 'label' => $this->randomMachineName()))->save();
}
}
作者:anatalsce
项目:en-class
function setUp()
{
parent::setUp();
// Create an administrative user.
$this->admin_user = $this->drupalCreateUser(array('administer taxonomy'));
$this->drupalLogin($this->admin_user);
// Add some custom languages.
$language = new Language(array('id' => 'aa', 'name' => $this->randomMachineName()));
language_save($language);
$language = new Language(array('id' => 'bb', 'name' => $this->randomMachineName()));
language_save($language);
}
作者:Nikola-xii
项目:d8intrane
protected function setUp()
{
parent::setUp();
// Create a tags vocabulary for the 'article' content type.
$vocabulary = entity_create('taxonomy_vocabulary', array('name' => 'Tags', 'vid' => 'tags'));
$vocabulary->save();
$field_name = 'field_' . $vocabulary->id();
entity_create('field_storage_config', array('field_name' => $field_name, 'entity_type' => 'node', 'type' => 'taxonomy_term_reference', 'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED, 'settings' => array('allowed_values' => array(array('vocabulary' => $vocabulary->id(), 'parent' => 0)))))->save();
entity_create('field_config', array('entity_type' => 'node', 'field_name' => $field_name, 'bundle' => 'article', 'label' => 'Tags'))->save();
entity_get_form_display('node', 'article', 'default')->setComponent($field_name, array('type' => 'taxonomy_autocomplete'))->save();
$this->drupalLogin($this->drupalCreateUser(['administer taxonomy', 'administer nodes', 'bypass node access']));
}
作者:Nikola-xii
项目:d8intrane
protected function setUp()
{
parent::setUp();
$this->drupalLogin($this->drupalCreateUser(['view test entity', 'administer entity_test content', 'administer taxonomy']));
$this->vocabulary1 = $this->createVocabulary();
$this->vocabulary2 = $this->createVocabulary();
// Set up a field storage and a field.
$this->fieldName = Unicode::strtolower($this->randomMachineName());
entity_create('field_storage_config', array('field_name' => $this->fieldName, 'entity_type' => 'entity_test', 'type' => 'taxonomy_term_reference', 'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED, 'settings' => array('allowed_values' => array(array('vocabulary' => $this->vocabulary1->id(), 'parent' => '0'), array('vocabulary' => $this->vocabulary2->id(), 'parent' => '0')))))->save();
entity_create('field_config', array('field_name' => $this->fieldName, 'entity_type' => 'entity_test', 'bundle' => 'entity_test'))->save();
entity_get_form_display('entity_test', 'entity_test', 'default')->setComponent($this->fieldName, array('type' => 'options_select'))->save();
entity_get_display('entity_test', 'entity_test', 'full')->setComponent($this->fieldName, array('type' => 'taxonomy_term_reference_link'))->save();
}
作者:davidsoloma
项目:drupalconsole.co
protected function setUp()
{
parent::setUp();
$web_user = $this->drupalCreateUser(array('bypass node access', 'administer taxonomy'));
$this->drupalLogin($web_user);
$this->vocabulary = $this->createVocabulary();
// Create the field.
$this->fieldName = 'field_taxonomy_test';
$this->createTaxonomyTermReferenceField($this->fieldName, $this->vocabulary);
// Set the RDF mapping for the new field.
rdf_get_mapping('node', 'article')->setFieldMapping($this->fieldName, array('properties' => array('dc:subject'), 'mapping_type' => 'rel'))->save();
rdf_get_mapping('taxonomy_term', $this->vocabulary->id())->setBundleMapping(array('types' => array('skos:Concept')))->setFieldMapping('name', array('properties' => array('rdfs:label')))->save();
}
作者:anatalsce
项目:en-class
function setUp()
{
parent::setUp();
// Create an administrative user.
$this->admin_user = $this->drupalCreateUser(array('administer taxonomy'));
$this->drupalLogin($this->admin_user);
// Create a vocabulary to which the terms will be assigned.
$this->vocabulary = $this->createVocabulary();
// Add some custom languages.
foreach (array('aa', 'bb', 'cc') as $language_code) {
$language = new Language(array('id' => $language_code, 'name' => $this->randomMachineName()));
language_save($language);
}
}
作者:ddrozdi
项目:dmap
protected function setUp()
{
parent::setUp();
// Remove access content permission from registered users.
user_role_revoke_permissions(RoleInterface::AUTHENTICATED_ID, array('access content'));
$this->vocabulary = $this->createVocabulary();
// Add a field to the vocabulary.
$entity_type = 'taxonomy_term';
$name = 'field_test';
entity_create('field_storage_config', array('field_name' => $name, 'entity_type' => $entity_type, 'type' => 'image', 'settings' => array('uri_scheme' => 'private')))->save();
entity_create('field_config', array('field_name' => $name, 'entity_type' => $entity_type, 'bundle' => $this->vocabulary->id(), 'settings' => array()))->save();
entity_get_display($entity_type, $this->vocabulary->id(), 'default')->setComponent($name, array('type' => 'image', 'settings' => array()))->save();
entity_get_form_display($entity_type, $this->vocabulary->id(), 'default')->setComponent($name, array('type' => 'image_image', 'settings' => array()))->save();
}
作者:davidsoloma
项目:drupalconsole.co
protected function setUp()
{
parent::setUp();
$web_user = $this->drupalCreateUser(array('view test entity', 'administer entity_test content', 'administer taxonomy', 'administer entity_test fields'));
$this->drupalLogin($web_user);
$this->vocabulary = $this->createVocabulary();
// Setup a field.
$this->field_name = drupal_strtolower($this->randomMachineName());
$this->field_storage = entity_create('field_storage_config', array('field_name' => $this->field_name, 'entity_type' => 'entity_test', 'type' => 'taxonomy_term_reference', 'settings' => array('allowed_values' => array(array('vocabulary' => $this->vocabulary->id(), 'parent' => '0')))));
$this->field_storage->save();
entity_create('field_config', array('field_storage' => $this->field_storage, 'bundle' => 'entity_test'))->save();
entity_get_form_display('entity_test', 'entity_test', 'default')->setComponent($this->field_name, array('type' => 'options_select'))->save();
entity_get_display('entity_test', 'entity_test', 'full')->setComponent($this->field_name, array('type' => 'taxonomy_term_reference_link'))->save();
}
作者:ddrozdi
项目:dmap
protected function setUp()
{
parent::setUp();
$web_user = $this->drupalCreateUser(array('bypass node access', 'administer taxonomy'));
$this->drupalLogin($web_user);
$this->vocabulary = $this->createVocabulary();
// Create the field.
$this->fieldName = 'field_taxonomy_test';
$handler_settings = array('target_bundles' => array($this->vocabulary->id() => $this->vocabulary->id()), 'auto_create' => TRUE);
$this->createEntityReferenceField('node', 'article', $this->fieldName, 'Tags', 'taxonomy_term', 'default', $handler_settings, FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED);
entity_get_form_display('node', 'article', 'default')->setComponent($this->fieldName, array('type' => 'options_select'))->save();
entity_get_display('node', 'article', 'full')->setComponent($this->fieldName, array('type' => 'entity_reference_label'))->save();
// Set the RDF mapping for the new field.
rdf_get_mapping('node', 'article')->setFieldMapping($this->fieldName, array('properties' => array('dc:subject'), 'mapping_type' => 'rel'))->save();
rdf_get_mapping('taxonomy_term', $this->vocabulary->id())->setBundleMapping(array('types' => array('skos:Concept')))->setFieldMapping('name', array('properties' => array('rdfs:label')))->save();
}
作者:aWEBoLab
项目:tax
protected function setUp()
{
parent::setUp();
// Create an administrative user.
$this->drupalLogin($this->drupalCreateUser(['administer taxonomy', 'bypass node access']));
// Create a vocabulary and add two term reference fields to article nodes.
$this->vocabulary = $this->createVocabulary();
$this->fieldName1 = Unicode::strtolower($this->randomMachineName());
$handler_settings = array('target_bundles' => array($this->vocabulary->id() => $this->vocabulary->id()), 'auto_create' => TRUE);
$this->createEntityReferenceField('node', 'article', $this->fieldName1, NULL, 'taxonomy_term', 'default', $handler_settings, FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED);
entity_get_form_display('node', 'article', 'default')->setComponent($this->fieldName1, array('type' => 'options_select'))->save();
entity_get_display('node', 'article', 'default')->setComponent($this->fieldName1, array('type' => 'entity_reference_label'))->save();
$this->fieldName2 = Unicode::strtolower($this->randomMachineName());
$this->createEntityReferenceField('node', 'article', $this->fieldName2, NULL, 'taxonomy_term', 'default', $handler_settings, FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED);
entity_get_form_display('node', 'article', 'default')->setComponent($this->fieldName2, array('type' => 'options_select'))->save();
entity_get_display('node', 'article', 'default')->setComponent($this->fieldName2, array('type' => 'entity_reference_label'))->save();
}