You are here

public function TermStorage::create in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/taxonomy/src/TermStorage.php \Drupal\taxonomy\TermStorage::create()

Parameters

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

Overrides EntityStorageBase::create

File

core/modules/taxonomy/src/TermStorage.php, line 74
Contains \Drupal\taxonomy\TermStorage.

Class

TermStorage
Defines a Controller class for taxonomy terms.

Namespace

Drupal\taxonomy

Code

public function create(array $values = array()) {

  // Save new terms with no parents by default.
  if (empty($values['parent'])) {
    $values['parent'] = array(
      0,
    );
  }
  $entity = parent::create($values);
  return $entity;
}