Создается словарь тегов и крепится к материалу article
<?php // Create a default vocabulary named "Tags", enabled for the 'article' content type. $description = st('Use tags to group articles on similar topics into categories.'); $help = st('Enter a comma-separated list of words to describe your content.'); $vocabulary = (object) array( 'name' => 'Tags', 'description' => $description, 'machine_name' => 'tags', 'help' => $help,
Прикрепить словарь к материалу
Из профиля установки:
Создается словарь тегов и крепится к материалу article
<?php
// Create a default vocabulary named "Tags", enabled for the 'article' content type.
$description = st('Use tags to group articles on similar topics into categories.');
$help = st('Enter a comma-separated list of words to describe your content.');
$vocabulary = (object) array(
'name' => 'Tags',
'description' => $description,
'machine_name' => 'tags',
'help' => $help,
);
taxonomy_vocabulary_save($vocabulary);
$instance = array(
'field_name' => 'taxonomy_' . $vocabulary->machine_name,
'object_type' => 'node',
'label' => $vocabulary->name,
'bundle' => 'article',
'description' => $vocabulary->help,
'widget' => array(
'type' => 'taxonomy_autocomplete',
'weight' => 4,
),
);
field_create_instance($instance);
?>