public TermStorage::updateTermHierarchy(EntityInterface $term)
Updates terms hierarchy information with the hierarchy trail of it.
Parameters
\Drupal\Core\Entity\EntityInterface $term: Term entity that needs to be added to term hierarchy information.
Overrides TermStorageInterface::updateTermHierarchy
File
- core/modules/taxonomy/src/TermStorage.php, line 105
Class
- TermStorage
- Defines a Controller class for taxonomy terms.
Namespace
Drupal\taxonomy
Code
1 2 3 4 5 6 7 8 9 10 11 12 | public function updateTermHierarchy(EntityInterface $term ) { $query = $this ->database->insert( 'taxonomy_term_hierarchy' ) ->fields( array ( 'tid' , 'parent' )); foreach ( $term ->parent as $parent ) { $query ->values( array ( 'tid' => $term ->id(), 'parent' => (int) $parent ->target_id, )); } $query ->execute(); } |
Please login to continue.