public function TermStorageController::create

Overrides Drupal\Core\Entity\DatabaseStorageController::create().

Parameters

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

Overrides DatabaseStorageControllerNG::create

File

drupal/core/modules/taxonomy/lib/Drupal/taxonomy/TermStorageController.php, line 26
Definition of Drupal\taxonomy\TermStorageController.

Class

TermStorageController
Defines a Controller class for taxonomy terms.

Namespace

Drupal\taxonomy

Code

public function create(array $values) {

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