0
下面的代碼將在所有分類文本字段添加表單,但我想添加文本字段的具體分類標準「色」Drupal的7 - 通過編程對特定分類
if(!db_table_exists('field_data_field_moi_uc_oid')){
$field = array(
'field_name' => 'field_moi_uc_oid',
'type' => 'text',
'label' => t('Relates to option')
);
field_create_field($field);
}
// Attach the field to our taxonomy entity
$instance = array(
'field_name' => 'field_moi_uc_oid',
'entity_type' => 'taxonomy_term',
'bundle' => 'variant',
'label' => t('Relates to option'),
'description' => t('This is the description'),
'required' => true,
'widget' => array(
'type' => 'text_textfield',
'settings'=> array(
'max_width'=>80,
)
),
);
field_create_instance($instance);
您目前正在將該字段應用於「變體」分類標準/分析包的分類術語。 'variant'是你的分類。顏色在哪裏進入? – 2pha
變體是詞彙,這個詞彙包含兩個分類,顏色和大小。不同的領域需要爲這兩個分類創建 – Bharanikumar
然後我對你的設置感到困惑。據我所知,分類術語被添加到詞彙表中。 – 2pha