【发布时间】:2018-04-20 18:25:57
【问题描述】:
我正在 Drupal 8 中构建一个自定义复合字段。我快到了,但我还缺少最后一点:当我将此新字段类型添加到内容类型时,分类自动完成字段会从每个分类中提取网站上的词汇。
我正在尝试确定如何仅从特定的“plant_parts”词汇中提取。目前,在我的小部件代码中,我有这个:
$element['plant_component_measured'] = array(
'#type' => 'entity_autocomplete',
'#target_type' => 'taxonomy_term',
'#title' => t('Plant part'),
'#prefix' => '<table><tr><td>',
'#suffix' => ' ',
'#default_value' => isset($items[$delta]->plant_component_measured) ?
$items[$delta]->plant_component_measured : NULL,
);
【问题讨论】:
-
实际上..取得了进展,插入:'#selection_settings' => array('target_bundles' => array('taxonomy_term', 'plant_part'), ),
标签: plugins drupal taxonomy fieldtype