1 taxonomy.entity.inc public TaxonomyTermController::create(array $values)

Overrides EntityDatabaseStorageController::create().

Parameters

array $values: An array of values to set, keyed by property name. A value for the vocabulary ID ('vid') is required.

Overrides EntityDatabaseStorageController::create

File

core/modules/taxonomy/taxonomy.entity.inc, line 183
Entity classes and controllers for Taxonomy module.

Class

TaxonomyTermController
Controller class for taxonomy terms.

Code

public function create(array $values) {
  $entity = parent::create($values);

  // Save new terms with no parents by default.
  if (!isset($entity->parent)) {
    $entity->parent = array(0);
  }
  return $entity;
}