Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/solr/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Drupal 7自定义管理面板中添加内容的字段_Drupal - Fatal编程技术网

Drupal 7自定义管理面板中添加内容的字段

Drupal 7自定义管理面板中添加内容的字段,drupal,Drupal,我已经将分类法配置为内容类型的字段,但我想将复选框标签(与iphone一起使用)替换为图像,该图像是该分类法的图像字段(参见照片) 现在我只知道通过添加以下代码来更改第290行的node.pages.inc: $form['product_label'] = array( '#type' => 'checkboxes', '#title' => 'Checkboxes Title', '#title_display' => 'before', '

我已经将分类法配置为内容类型的字段,但我想将复选框标签(与iphone一起使用)替换为图像,该图像是该分类法的图像字段(参见照片)

现在我只知道通过添加以下代码来更改第290行的node.pages.inc:

$form['product_label'] = array(
    '#type' => 'checkboxes',
    '#title' => 'Checkboxes Title',
    '#title_display' => 'before',
    '#default_value' => array(0,2),
    '#options' => array(
      0 => 'option one',
      1 => 'option two',
      2 => 'option three', 
    ), 
    '#theme' => 'testmodule_checkboxes',
  );
产品标签是复选框名称,上面的代码将覆盖当前复选框字段。但我认为这不是最好的方式。。 谁能给我指路?什么模块或编码可以做到这一点?

最好的地方是在你的主题。在
template.php
中,您需要使用,来更改特定的表单。您可以了解有关FAPI(FormAPI)和的更多信息

有几种方法可以更改表单以获得所需的结果。最简单的方法是将每个图标的唯一类添加到每个表单项的数组中。然后,您可以使用CSS与图标进行交互(这使得它更容易访问,因为屏幕阅读器仍然能够读取文本)