Программно создать термин Term Taxonomy Drupal (с Domain Access)

    Опубликовано Andres - пн, 02/04/2019 - 13:41

    $vocabulary = taxonomy_vocabulary_machine_name_load($data_term['vocabulary_machine_name']);
    $term = (object)array(
      'vid' => $vocabulary->vid,
      'name' => $data_term['title'],
      'parent' => $data_term['parent'],
    );

    // Зависимость от домена

    $term->domain_update_subterm = 0;
    $term->domain_update_subnodes = 0;
    $term->domain_load_from_parent = 0;
    $term->domain_site = 0;

    $term->domains['1'] = 1;
    $term->domains['2'] = 0;
    $term->domains['3'] = 0;

    $term->domain_source = "1";
        
                
    taxonomy_term_save($term);
    domain_taxonomy_save_term($term); // WARNING :)