当前位置: 首页>>代码示例>>PHP>>正文


PHP Term::save方法代码示例

本文整理汇总了PHP中Drupal\taxonomy\Entity\Term::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Term::save方法的具体用法?PHP Term::save怎么用?PHP Term::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Drupal\taxonomy\Entity\Term的用法示例。


在下文中一共展示了Term::save方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('entity_test_rev');
     entity_reference_create_field($this->entityType, $this->bundle, $this->fieldName, 'Field test', $this->entityType);
     // Add the mapping.
     $mapping = rdf_get_mapping('entity_test', 'entity_test');
     $mapping->setFieldMapping($this->fieldName, array('properties' => array('schema:knows')))->save();
     // Create the entity to be referenced.
     $this->target_entity = entity_create($this->entityType, array('name' => $this->randomMachineName()));
     $this->target_entity->save();
     // Create the entity that will have the entity reference field.
     $this->entity = entity_create($this->entityType, array('name' => $this->randomMachineName()));
     $this->entity->save();
     $this->entity->{$this->fieldName}->entity = $this->target_entity;
     $this->entity->{$this->fieldName}->access = TRUE;
     $this->uri = $this->getAbsoluteUri($this->entity);
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:18,代码来源:EntityReferenceRdfaTest.php

示例2: setUp

 public function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('taxonomy_term');
     $vocabulary = entity_create('taxonomy_vocabulary', array('name' => $this->randomName(), 'vid' => drupal_strtolower($this->randomName()), 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED));
     $vocabulary->save();
     entity_create('field_storage_config', array('name' => $this->fieldName, 'entity_type' => 'entity_test', 'type' => 'taxonomy_term_reference', 'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED, 'settings' => array('allowed_values' => array(array('vocabulary' => $vocabulary->id(), 'parent' => 0)))))->save();
     entity_create('field_instance_config', array('entity_type' => 'entity_test', 'field_name' => $this->fieldName, 'bundle' => 'entity_test'))->save();
     $this->term = entity_create('taxonomy_term', array('name' => $this->randomName(), 'vid' => $vocabulary->id(), 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED));
     $this->term->save();
     // Add the mapping.
     $mapping = rdf_get_mapping('entity_test', 'entity_test');
     $mapping->setFieldMapping($this->fieldName, array('properties' => array('schema:about')))->save();
     // Set up test values.
     $this->entity = entity_create('entity_test');
     $this->entity->{$this->fieldName}->target_id = $this->term->id();
     $this->entity->save();
     $this->uri = $this->getAbsoluteUri($this->entity);
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:19,代码来源:TaxonomyTermReferenceRdfaTest.php

示例3: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('entity_test_rev');
     // Give anonymous users permission to view test entities.
     $this->installConfig(array('user'));
     Role::load(RoleInterface::ANONYMOUS_ID)->grantPermission('view test entity')->save();
     $this->createEntityReferenceField($this->entityType, $this->bundle, $this->fieldName, 'Field test', $this->entityType);
     // Add the mapping.
     $mapping = rdf_get_mapping('entity_test', 'entity_test');
     $mapping->setFieldMapping($this->fieldName, array('properties' => array('schema:knows')))->save();
     // Create the entity to be referenced.
     $this->targetEntity = entity_create($this->entityType, array('name' => $this->randomMachineName()));
     $this->targetEntity->save();
     // Create the entity that will have the entity reference field.
     $this->entity = entity_create($this->entityType, array('name' => $this->randomMachineName()));
     $this->entity->save();
     $this->entity->{$this->fieldName}->entity = $this->targetEntity;
     $this->uri = $this->getAbsoluteUri($this->entity);
 }
开发者ID:nstielau,项目名称:drops-8,代码行数:20,代码来源:EntityReferenceRdfaTest.php

示例4: setUpTerm

 /**
  * Creates a test subject term, with translation.
  */
 protected function setUpTerm()
 {
     $this->term = $this->createTerm($this->vocabulary, array('name' => $this->baseTagName, 'langcode' => $this->baseLangcode));
     $this->term->addTranslation($this->translateToLangcode, array('name' => $this->translatedTagName));
     $this->term->save();
 }
开发者ID:nsp15,项目名称:Drupal8,代码行数:9,代码来源:TermTranslationFieldViewTest.php


注:本文中的Drupal\taxonomy\Entity\Term::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。