public function Pathautoi18nTaxonomyTest::createTaxonomyTerm in Pathauto i18n 7
Helper to create taxonomy term.
3 calls to Pathautoi18nTaxonomyTest::createTaxonomyTerm()
- Pathautoi18nTaxonomyTest::testAutomaticAliasTaxonomy in tests/
pathauto_i18n_taxonomy.test - Test taxonomy terms with automatic alias.
- Pathautoi18nTaxonomyTest::testCleanString in tests/
pathauto_i18n_taxonomy.test - Test clearing of string.
- Pathautoi18nTaxonomyTest::testCustomAliasTaxonomy in tests/
pathauto_i18n_taxonomy.test - Test taxonomy terms with custom alias for certain language.
File
- tests/
pathauto_i18n_taxonomy.test, line 99
Class
- Pathautoi18nTaxonomyTest
- Test functionality for taxonomy.
Code
public function createTaxonomyTerm($pathauto_i18n_status, $pathauto, $alias = FALSE) {
$vocabulary = taxonomy_vocabulary_machine_name_load(PATHAUTO_I18N_TAG_VOCABULARU_MACHINE_NAME);
$term = new stdClass();
$term->name = $this->title;
$term->description = $this->title;
// Use the first available text format.
$term->format = db_query_range('SELECT format FROM {filter_format}', 0, 1)
->fetchField();
$term->vid = $vocabulary->vid;
$term->path = array(
'pathauto_i18n_status' => $pathauto_i18n_status,
'pathauto' => $pathauto,
);
if (!empty($alias)) {
$term->path['alias'] = $alias;
}
taxonomy_term_save($term);
}