TermStorage::create

public TermStorage::create(array $values = array())

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 69

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;
}
doc_Drupal
2016-10-29 09:47:21
Comments
Leave a Comment

Please login to continue.